question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SemanticTokensBuilder.buildEdits() returning incorrect deleteCount

See original GitHub issue

I’m working on an issue where the users of a language server that I’m the maintainer of see their semantic coloring go haywire when doing deletes. I’ve confirmed that if I modify my language server to provide full tokens for a document every time (it currently registers as a full and delta provider), the tokens are correct after a delete. However, when registering as a delta provider and using the SemanticTokensBuilder.buildEdits() function, I observe this behavior:

My document upon open contains this text:

Class User.short
{

/// desc
ClassMethod t()
{
    q 1
}

}

And these tokens:

[ 0, 0, 5, 4, 0 ]
[ 0, 6, 4, 5, 0 ]
[ 0, 4, 1, 5, 0 ]
[ 0, 1, 5, 5, 0 ]
[ 1, 0, 1, 8, 0 ]
[ 2, 0, 3, 7, 0 ]
[ 0, 4, 4, 7, 0 ]
[ 1, 0, 11, 4, 0 ]
[ 0, 12, 1, 11, 0 ]
[ 0, 1, 2, 8, 0 ]
[ 1, 0, 1, 8, 0 ]
[ 1, 4, 1, 60, 0 ]
[ 0, 2, 1, 51, 0 ]
[ 1, 0, 1, 8, 0 ]
[ 2, 0, 1, 8, 0 ]

If I delete the line /// desc (tokens 6 & 7), the result of textDocument/semanticTokens/full/delta is:

{
    "resultId": "1618608792098",
    "edits": [
        {
            "start": 27,
            "deleteCount": 9,
            "data": []
        }
    ]
}

and the expected result is:

{
    "resultId": "1618608792098",
    "edits": [
        {
            "start": 27,
            "deleteCount": 10,
            "data": []
        }
    ]
}

I’m using VSCode 1.55.2 and vscode-languageclient/server 7.0.0

Original issue: https://github.com/intersystems/language-server/issues/29

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dbaeumercommented, Jun 16, 2021

Release server@7.1.0-next.5 and client@7.1.0-next.5

1reaction
dbaeumercommented, Jun 10, 2021

Sorry for that. I can make a next version beginning on next week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Semantic tokens edits handler returns incorrect deltas #54671
I believe the fix is to translate the spans to the text version backed by GetTrackedDocumentSourceText or similar to get your results against ......
Read more >
Semantic Highlight Guide | Visual Studio Code Extension API
Semantic tokenization allows language servers to provide additional token information based on the language server's knowledge on how to resolve symbols in the ......
Read more >
D77811 [clangd] Implement semanticTokens modifiers - LLVM
Commits: rGdd8fb21227ce: [clangd] Implement semanticTokens modifiers ... because getPointeeType() returns null... but I guess that works.
Read more >
Spring Data MongoDB - Reference Documentation
The query builder mechanism built into the Spring Data repository infrastructure is useful for building constraining queries over entities of the repository ...
Read more >
vscode.DocumentSemanticTokensProvider - API documentation
The document semantic tokens provider interface defines the contract ... this method ( provideDocumentSemanticTokensEdits ) and then return incremental ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found