Skip to content

Difference in behavior with encodedSemanticClassifications-full in TS 4.1 compared to using VS Code plugin #41262

Closed
@mjbvz

Description

@mjbvz

TypeScript Version: 4.1.0-dev.20201026

Repro

  1. Using TS 4.1.0-dev.20201026 and a build of VS Code that explicitly disables the typescript-vscode-sh-plugin plugin

    Here's the change in the VS Code repo that disables the plugin:

    diff --git a/extensions/typescript-language-features/package.json b/extensions/typescript-language-features/package.json
    index dfd3f6295a..aa3763aaf7 100644
    --- a/extensions/typescript-language-features/package.json
    +++ b/extensions/typescript-language-features/package.json
    @@ -1114,12 +1114,6 @@
            }
            ]
        }
    -    ],
    -    "typescriptServerPlugins": [
    -      {
    -        "name": "typescript-vscode-sh-plugin",
    -        "enableForWorkspaceTypeScriptVersions": true
    -      }
        ]
    }
    }
  2. Use the TS File:

    class Foo {}
    
    const a = Foo;
    
    console.log(a);
  3. Look at semantic highlighting

Bug
With TS 4.1 and the plugin disabled, I see this response:

[Trace  - 00:50:46.802] <semantic> Response received: encodedSemanticClassifications-full (17). Request took 1673 ms. Success: true 
Result: {
    "spans": [
        6,
        3,
        11,
        24,
        3,
        11
    ],
    "endOfLineState": 0
}

With the plugin enabled, I see:

[Trace  - 00:50:59.813] <semantic> Response received: encodedSemanticClassifications-full (16). Request took 980 ms. Success: true 
Result: {
    "spans": [
        6,
        3,
        257,
        20,
        1,
        257,
        24,
        3,
        256,
        30,
        7,
        2064,
        38,
        3,
        3088,
        42,
        1,
        256
    ],
    "endOfLineState": 0
}

As you can see, the plugin seems to be providing a lot more information

@orta Is there any work we need to do on the VS Code side to adopt the new semantic work in TS 4.1?

/cc @aeschli

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions