Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1813,6 +1813,11 @@
"title": "%java.server.restart%",
"category": "Java"
},
{
"command": "java.runtime.restartIntellisense",
"title": "Restart IntelliSense for Active File",
"category": "Java"
},
{
"command": "java.action.filesExplorerPasteAction",
"title": "%java.action.filesExplorerPasteAction%",
Expand Down Expand Up @@ -1941,6 +1946,11 @@
"command": "java.action.showTypeHierarchy",
"when": "javaLSReady && editorTextFocus && editorLangId == java",
"group": "0_navigation@3"
},
{
"command": "java.runtime.restartIntellisense",
"when": "editorTextFocus && editorLangId == java",
"group": "navigation@91"
}
],
"commandPalette": [
Expand Down
1 change: 1 addition & 0 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ export namespace Commands {
* Command to restart the language server.
*/
export const RESTART_LANGUAGE_SERVER = 'java.server.restart';
export const RESTART_INTELLISENSE_FOR_ACTIVE_FILE = 'java.runtime.restartIntellisense';

export const LEARN_MORE_ABOUT_REFACTORING = '_java.learnMoreAboutRefactorings';

Expand Down
7 changes: 7 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,13 @@ function registerRestartJavaLanguageServerCommand(context: ExtensionContext) {
break;
}
}));
context.subscriptions.push(commands.registerCommand(Commands.RESTART_INTELLISENSE_FOR_ACTIVE_FILE, async () => {
const editor = window.activeTextEditor;
if (!editor || editor.document.languageId !== "java") {
return;
}
await commands.executeCommand(Commands.RESTART_LANGUAGE_SERVER);
}));
}

function escapeSnippetLiterals(value: string): string {
Expand Down
1 change: 1 addition & 0 deletions test/lightweight-mode-suite/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ suite('Java Language Extension - LightWeight', () => {
Commands.SWITCH_SERVER_MODE,
Commands.OPEN_FILE,
Commands.CLEAN_SHARED_INDEXES,
Commands.RESTART_INTELLISENSE_FOR_ACTIVE_FILE,
Commands.RESTART_LANGUAGE_SERVER,
Commands.FILESEXPLORER_ONPASTE,
Commands.CHANGE_JAVA_SEARCH_SCOPE,
Expand Down
Loading