Code Context Assembly for Accurate Predictions

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current code language models are limited in their predictive capabilities as they only use text before the editor cursor and do not consider text after the cursor or in related files, which restricts their usefulness in coding scenarios where programmers often work on related files simultaneously.

Innovation Solution

A code context assembly system that identifies relevant text before and after the cursor, in neighboring editor tabs, and in other code files, and uses metadata to generate context suggestions by constructing a comprehensive prompt from a wishlist of wish items, prioritizing and processing these to provide accurate code completions.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If code language models use only text before the cursor for predictions, then the model complexity remains simple, but the prediction accuracy is limited

Engineering Contradiction:
Improveprediction accuracyVSAvoidmodel complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent segments the code context into multiple distinct components: text before cursor, text after cursor, related file text, and metadata. Each segment is processed separately and then integrated, allowing the model to handle complex contexts systematically without overwhelming complexity

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent extends the context dimension from one-dimensional (text before cursor) to multi-dimensional by incorporating text after cursor, related files, and metadata. This dimensional expansion provides richer context for predictions while maintaining manageable model architecture through structured processing

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

2Loss of information

If code language models consider only text before the cursor, then the processing time is short, but the context coverage is insufficient

Engineering Contradiction:
Improvecontext coverageVSAvoidprocessing time
Core Design Contradiction:
Loss of informationVSLoss of time

Solution Approach 1:

The patent performs preliminary actions by pre-identifying and organizing wish items (relevant text segments) before they are needed for prediction. The system proactively gathers text from multiple sources and structures it, so when prediction is needed, the context is already prepared and ready for efficient processing

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent extracts only the most relevant portions of text from various sources (after cursor, related files, metadata) rather than processing entire files. By selecting and extracting specific wish items that are most relevant to the current context, the system achieves comprehensive coverage without proportional increase in processing time

Inventive Principle:
Principle #2Taking out (Extraction)

3Adaptability or versatility

If code language models use text from multiple sources including related files, then the prediction relevance improves, but the system complexity increases

Engineering Contradiction:
Improveprediction relevanceVSAvoidsystem complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent creates a universal wish item processing framework that handles multiple types of text sources (current file before/after cursor, related files, metadata) through a single unified mechanism. This multi-functional approach improves prediction relevance across different scenarios while avoiding the need for separate specialized systems for each text source

Inventive Principle:
Principle #6Universality (Multi-functionality)

Data Source

PatentUS20230359442A1Code context assembly
Publication Date: 2023.11.09 MICROSOFT TECHNOLOGY LICENSING LLC
  • US20230359442A1 patent drawing
  • US20230359442A1 patent drawing
  • US20230359442A1 patent drawing

AI summary

A computer system is configured to identify a position of a cursor in an editor where a code file is displayed and identify one or more wish items based on the position of the cursor or metadata associated with the code file. The computer system is further configured to identify one or more first portions of text from the one or more wish items that are relevant to text immediately preceding the cursor, and prioritize the one or more first portions of text to identify a particular first portion of text that is most relevant to the text immediately preceding the cursor. The computer system then generates a second portion of text based on the particular first portion of text and suggest that the second portion of text be entered at the cursor.