Dynamic Language Code Completion via Runtime Context

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Generating complete and accurate completion lists at arbitrary points in code for dynamic languages is challenging due to the lack of a type system, making it difficult to resolve variable types and execute code outside of the runtime context, which existing techniques like altering the interpreter struggle to address effectively.

Innovation Solution

A language service provider framework that includes an application context generation component, a language service provider port component, and a management component, which generates and manages application contexts with runtime environment information to provide accurate available symbol sets, and selects or re-submits to language service providers to ensure timely and accurate symbol set generation.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of operation

If code execution is performed outside the actual application runtime context, then code analysis can be performed at arbitrary points, but execution reliability and accuracy deteriorate because it is difficult to guarantee halting at specific points and contriving valid inputs

Engineering Contradiction:
Improveability to perform code analysis at arbitrary pointsVSAvoidexecution reliability outside runtime context
Core Design Contradiction:
Ease of operationVSReliability

Solution Approach 1:

The patent introduces an intermediary mechanism (debugger/hook system) that mediates between the code execution engine and the analysis system. This intermediary can intercept execution flow, set breakpoints, and control halting at arbitrary points without requiring modifications to the original code, thus maintaining execution reliability while enabling flexible analysis points.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent creates a copy or simulation of the runtime environment that can be executed outside the actual application context. This copied environment preserves the necessary state and behavior characteristics, allowing code analysis to be performed on a replica while maintaining the reliability of the analysis results.

Inventive Principle:
Principle #26Copying

2Productivity

If dynamic language interpreters are altered to enable code analysis, then completion lists can be generated, but system complexity increases and original interpreter behavior may be affected

Engineering Contradiction:
Improvecompletion list generation capabilityVSAvoidinterpreter modification complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent segments the code analysis functionality from the interpreter core by implementing it as a separate debugging/analysis layer that interfaces with the interpreter through standardized hooks. This segmentation allows completion list generation without modifying the interpreter's core logic, maintaining simplicity while adding analytical capabilities.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an intermediary analysis layer that sits between the interpreter and the user interface. This intermediary handles all code analysis operations, including completion list generation, without requiring modifications to the interpreter itself, thus avoiding increased system complexity while maintaining productivity benefits.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Adaptability or versatility

If type resolution is performed without a type system in dynamic languages, then language flexibility is maintained, but variable type accuracy deteriorates making complete completion lists difficult to generate

Engineering Contradiction:
Improvedynamic language flexibilityVSAvoidvariable type resolution accuracy
Core Design Contradiction:
Adaptability or versatilityVSMeasurement precision

Solution Approach 1:

The patent performs preliminary type inference and resolution during the code analysis phase by examining variable declarations, assignments, and usage patterns before generating completion lists. This preliminary action establishes accurate type information dynamically, enabling precise completion lists while maintaining the flexibility of dynamic languages.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent implements a feedback mechanism where the analysis system continuously monitors variable assignments and type usage during code execution or static analysis, then uses this feedback information to refine type resolution accuracy. This feedback loop enables accurate type determination without requiring a formal type system, maintaining both flexibility and precision.

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS8869106B2Language service provider management using application context
Publication Date: 2014.10.21 MICROSOFT TECHNOLOGY LICENSING LLC
  • US8869106B2 patent drawing
  • US8869106B2 patent drawing
  • US8869106B2 patent drawing

AI summary

A language service provider framework that generates an application context of a dynamic language program being authored. The application context includes a description of the dynamic language application being authored, one or more specific locations within the program, and runtime environment information. A language service provider port component holds one or more language service providers. Each language service provider may receive the application context and generate a set of available symbols corresponding to each of at least one of the identified one or more specific locations. A management component receives the application context from the application context generation component, provides the application context the language service provider, and correspondingly receives the available symbol set from the language service provider. Since the management component provides an application context that also includes runtime environment information, the available symbol set may be more accurately represented, thereby facilitating authoring of dynamic language programs.