microsoft / microsoft/Power-Fx

[C2Fx] [Nl2Fx] Consider Comment Positions for Nl2Fx To Allow Adding inner Formula Scopes Specific Context (With() scopes)

Open
#2,215 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.4k
Forks
358
Avg merge
10h 34m
Merged PRs (30d)
3

Description

Comments 2 Fx variation of Nl2Fx supports converting comments into code suggestions. Comments could be anywhere in the formula. A formula can have inner scopes due to the use of With() functions. A comment inside a With() call can be thought of being scoped to that With() call. If we can know which scope comment overlaps with we can add more context to the Nl2Fx payload to get better suggestions. This could be achieved by extending Nl2Fx handling in LSP to take in position of the comment along with the comment text and then using that position to compute the chain of scopes above that comment and adding more stuff to the context for Nl2Fx model

See an example below, I have two variables "VarInComp"with the same name but in different scopes. Currently, i only pass in global VarInComp and that's why suggestion for my comment inside With() converts VarInComp to text from a number to get its length. This is not accurate as my comment is inside With() scope and it has its own VarInComp which is already a text/string

Currently the Nl2FxPayload looks like this {sentence, context, textDocument}. We can add a position of type integer in the payload making it {sentence: string, context: string, textDocument: {uri:string}, position: number}. Position is a 0 based index into the formula string. Now we would also need a formula in the Nl2FxPayload so we would also need to accomodate that in the payload. we might need to add that as well.

image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing Nl2Fx handling in the LSP and the Nl2FxPayload shape described in the issue. Determine how a comment position and formula can identify enclosing With() scopes, then verify that the resulting scope-specific context reaches Nl2Fx suggestions.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.