Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move semantic tokens to LSP implementation #2000

Merged
merged 1 commit into from
Sep 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Move semantic tokens to LSP implementation
Signed-off-by: 0dinD <[email protected]>
0dinD committed Sep 6, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit a4659200af2c90f4689f9177d3f0d8626f7e78c0
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -173,7 +173,6 @@ The following settings are supported:
Default launch mode is `Hybrid`. Legacy mode is `Standard`
* `java.sources.organizeImports.starThreshold`: Specifies the number of imports added before a star-import declaration is used, default is 99.
* `java.sources.organizeImports.staticStarThreshold`: Specifies the number of static imports added before a star-import declaration is used, default is 99.
* `java.semanticHighlighting.enabled`: Enable/disable [Semantic Highlighting](https://github.com/redhat-developer/vscode-java/wiki/Semantic-Highlighting) for Java files. Defaults to `true`.
* `java.imports.gradle.wrapper.checksums`: Defines allowed/disallowed SHA-256 checksums of Gradle Wrappers.
* `java.project.importOnFirstTimeStartup`: Specifies whether to import the Java projects, when opening the folder in Hybrid mode for the first time. Supported values are `disabled` (never imports), `interactive` (asks to import or not), `automatic` (always imports). Default to `automatic`.
* `java.project.importHint`: Enable/disable the server-mode switch information, when Java projects import is skipped on startup. Defaults to `true`.
@@ -197,7 +196,7 @@ The following settings are supported:

Semantic Highlighting
===============
[Semantic Highlighting](https://github.com/redhat-developer/vscode-java/wiki/Semantic-Highlighting) is controlled by the `java.semanticHighlighting.enabled` preference. When enabled, it fixes numerous syntax highlighting issues with the default Java Textmate grammar. However, you might experience different small issues, particularly a delay when it kicks in, as it needs to be computed by the Java Language server, when opening a new file or when typing.
[Semantic Highlighting](https://github.com/redhat-developer/vscode-java/wiki/Semantic-Highlighting) fixes numerous syntax highlighting issues with the default Java Textmate grammar. However, you might experience a few minor issues, particularly a delay when it kicks in, as it needs to be computed by the Java Language server, when opening a new file or when typing. Semantic highlighting can be disabled for all languages using the `editor.semanticHighlighting.enabled` setting, or for Java only using [language-specific editor settings](https://code.visualstudio.com/docs/getstarted/settings#_languagespecific-editor-settings).

Troubleshooting
===============
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -710,12 +710,6 @@
"scope": "window",
"minimum": 1
},
"java.semanticHighlighting.enabled": {
"type": "boolean",
"default": true,
"description": "Enable/disable the semantic highlighting.",
"scope": "window"
},
"java.imports.gradle.wrapper.checksums": {
"type": "array",
"items": {
@@ -1115,7 +1109,7 @@
"fmtr": "^1.1.2",
"fs-extra": "^8.1.0",
"glob": "^7.1.3",
"vscode-languageclient": "7.0.0",
"vscode-languageclient": "7.1.0-next.5",
"winreg-utf8": "^0.1.1",
"winston": "^3.2.1",
"winston-daily-rotate-file": "^3.10.0"
8 changes: 0 additions & 8 deletions src/commands.ts
Original file line number Diff line number Diff line change
@@ -230,14 +230,6 @@ export namespace Commands {
* Get all java projects root path in URI format
*/
export const GET_ALL_JAVA_PROJECTS = 'java.project.getAll';
/**
* Temporary command for Semantic Highlighting. To remove when LSP v3.16 is ready.
*/
export const PROVIDE_SEMANTIC_TOKENS = 'java.project.provideSemanticTokens';
/**
* Temporary command to fetch Semantic Tokens Legend. To remove when LSP v3.16 is ready.
*/
export const GET_SEMANTIC_TOKENS_LEGEND = 'java.project.getSemanticTokensLegend';
/**
* Command to switch between standard mode and lightweight mode.
*/
3 changes: 0 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -24,7 +24,6 @@ import { StandardLanguageClient } from './standardLanguageClient';
import { apiManager } from './apiManager';
import { SnippetCompletionProvider } from './snippetCompletionProvider';
import { runtimeStatusBarProvider } from './runtimeStatusBarProvider';
import { registerSemanticTokensProvider } from './semanticTokenProvider';
import { serverStatusBarProvider } from './serverStatusBarProvider';
import { markdownPreviewProvider } from "./markdownPreviewProvider";

@@ -325,8 +324,6 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
syntaxClient.stop();
fileEventHandler.setServerStatus(true);
runtimeStatusBarProvider.initialize(context.storagePath);
// temporary implementation Semantic Highlighting before it is part of LSP
registerSemanticTokensProvider(context);
}
commands.executeCommand('setContext', 'java:serverMode', event);
});
111 changes: 0 additions & 111 deletions src/semanticTokenProvider.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/standardLanguageClient.ts
Original file line number Diff line number Diff line change
@@ -90,7 +90,6 @@ export class StandardLanguageClient {

// Create the language client and start the client.
this.languageClient = new LanguageClient('java', extensionName, serverOptions, clientOptions);
this.languageClient.registerProposedFeatures();

this.languageClient.onReady().then(() => {
activationProgressNotification.showProgress();
13 changes: 0 additions & 13 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -113,16 +113,3 @@ function parseToStringGlob(patterns: string[]): string {

return `{${patterns.join(",")}}`;
}

export async function waitForDocumentChangesToEnd(document: TextDocument): Promise<void> {
let version = document.version;
return new Promise((resolve) => {
const iv = setInterval(() => {
if (document.version === version) {
clearInterval(iv);
resolve();
}
version = document.version;
}, 400);
});
}