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.

Can't disable full document semantic tokens request

See original GitHub issue

I try to disable providing semantic tokens for a full document. But when I edit document, semanticTokens.on() is allways trigger ,not semanticTokens.onRange().

codes:

connection.languages.semanticTokens.on((handler, token, workDoneProgress, resultProgress) => {
	const t = Date.now();
	try {
		// ...
	}
	finally {
		console.log(`semanticTokens.on, time: ${Date.now() - t}ms`);
	}
})
connection.languages.semanticTokens.onRange((handler, token, workDoneProgress, resultProgress) => {
	const t = Date.now();
	try {
		// ...
	}
	finally {
		console.log(`semanticTokens.onRange, time: ${Date.now() - t}ms, lines: ${handler.range.start.line} ~ ${handler.range.end.line}`);
	}
});
connection.client.register(SemanticTokensRegistrationType.type, {
	// ...
	range: true,
	full: false, // <------------ disabled
});

log:

semanticTokens.onRange, time: 342ms, lines: 0 ~ 94
semanticTokens.on, time: 1447ms
semanticTokens.onRange, time: 21ms, lines: 0 ~ 93
semanticTokens.on, time: 2206ms
semanticTokens.on, time: 1419ms
semanticTokens.on, time: 1382ms
semanticTokens.on, time: 1435ms
semanticTokens.on, time: 1375ms
semanticTokens.on, time: 1372ms
semanticTokens.on, time: 1916ms
semanticTokens.on, time: 1937ms

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dbaeumercommented, Dec 11, 2020

The spec can’t force all clients to handle range only. There are clients out there that simply can’t implement this. This is why the spec behaves that way and it does in all other cases. So it is not a wrong design. It is on purpose!

This being said VS Code does support it and there was a problem in the library that didn’t call range in the absence of full. I fixed that.

0reactions
johnsoncodehkcommented, Jan 5, 2021

I will try again with npm run symlink:testbed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Semantic colorization requested for entire (large) file instead ...
So for the initial open of checker.ts , first the semantic tokens in the viewport will be fetched, and then the entire document...
Read more >
Avoid doing semantic tokens for large files
100,000 bytes. After getting this error, vscode, at least, will stop asking for full requests and use range requests. ... are more than...
Read more >
How to update semantic tokens as the visible range of the ...
To solve this issue, my idea was to check the editor's visible range as it changes when the user scrolls up and down,...
Read more >
Publishing Extensions - Visual Studio Code
Learn how to publish Visual Studio Code extensions to the public Marketplace and share them with other developers.
Read more >
GitLab CI/CD job token
After the job finishes, you can't use the token anymore. A job token can access a project's ... This setting is disabled by...
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