This is an automated email from the ASF dual-hosted git repository.
dbalek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 6862116550 VSCode: Renaming Java 8+ debug configuration to Java+.
(#5816)
6862116550 is described below
commit 68621165502b00599adf4622e0e7a14fc0565cb1
Author: Dusan Balek <[email protected]>
AuthorDate: Fri Apr 14 09:58:43 2023 +0200
VSCode: Renaming Java 8+ debug configuration to Java+. (#5816)
---
.../java/lsp/server/db/DBSetEnvCommand.java | 2 +-
.../attach/AttachConfigurationCompletion.java | 4 +-
.../debugging/attach/AttachConfigurations.java | 2 +-
.../protocol/ProjectConfigurationCompletion.java | 8 ++-
.../java/lsp/server/protocol/ServerTest.java | 4 +-
java/java.lsp.server/vscode/CHANGELOG.md | 3 +
java/java.lsp.server/vscode/README.md | 10 +--
java/java.lsp.server/vscode/package-lock.json | 16 ++---
java/java.lsp.server/vscode/package.json | 29 ++++----
java/java.lsp.server/vscode/src/extension.ts | 20 +++---
.../vscode/src/launchConfigurations.ts | 77 +++++++++++++++-------
.../java.lsp.server/vscode/src/runConfiguration.ts | 2 +-
.../vscode/src/test/suite/extension.test.ts | 2 +-
13 files changed, 110 insertions(+), 69 deletions(-)
diff --git
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBSetEnvCommand.java
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBSetEnvCommand.java
index f77f06ba7e..e27c7cf334 100644
---
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBSetEnvCommand.java
+++
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBSetEnvCommand.java
@@ -45,7 +45,7 @@ import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = CodeActionsProvider.class)
public class DBSetEnvCommand extends CodeActionsProvider {
private static final String COMMAND_SET_DB_ENV = "java.db.set.env";
//NOI18N
- private static final String CONFIG_SECTION = "java8+.runConfig"; //NOI18N
+ private static final String CONFIG_SECTION = "java+.runConfig"; //NOI18N
private static final Set<String> COMMANDS = new HashSet<>(Arrays.asList(
COMMAND_SET_DB_ENV
diff --git
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/attach/AttachConfigurationCompletion.java
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/attach/AttachConfigurationCompletion.java
index e17c152481..5ff3e14209 100644
---
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/attach/AttachConfigurationCompletion.java
+++
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/attach/AttachConfigurationCompletion.java
@@ -30,6 +30,7 @@ import java.util.function.Supplier;
import java.util.stream.Collectors;
import org.eclipse.lsp4j.CompletionItem;
+import org.eclipse.lsp4j.CompletionItemKind;
import org.eclipse.lsp4j.InsertTextFormat;
import org.netbeans.api.project.Project;
import org.netbeans.modules.java.lsp.server.Utils;
@@ -69,7 +70,8 @@ public class AttachConfigurationCompletion implements
LaunchConfigurationComplet
}
private static CompletionItem createCompletion(ConfigurationAttributes
configAttrs) {
- CompletionItem ci = new CompletionItem("Java 8+: " +
configAttrs.getName()); // NOI18N
+ CompletionItem ci = new CompletionItem("Java+: " +
configAttrs.getName()); // NOI18N
+ ci.setKind(CompletionItemKind.Module);
StringWriter sw = new StringWriter();
try (JsonWriter w = new JsonWriter(sw)) {
w.setIndent("\t"); //
NOI18N
diff --git
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/attach/AttachConfigurations.java
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/attach/AttachConfigurations.java
index 3a79ead521..7989a0598b 100644
---
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/attach/AttachConfigurations.java
+++
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/attach/AttachConfigurations.java
@@ -54,7 +54,7 @@ import org.openide.util.RequestProcessor;
*/
public final class AttachConfigurations {
- static final String CONFIG_TYPE = "java8+"; // NOI18N
+ static final String CONFIG_TYPE = "java+"; // NOI18N
static final String CONFIG_REQUEST = "attach"; // NOI18N
static final RequestProcessor RP = new
RequestProcessor(AttachConfigurations.class);
diff --git
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ProjectConfigurationCompletion.java
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ProjectConfigurationCompletion.java
index 159a2b4b4c..4a3e4098ab 100644
---
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ProjectConfigurationCompletion.java
+++
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ProjectConfigurationCompletion.java
@@ -30,6 +30,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;
import org.eclipse.lsp4j.CompletionItem;
+import org.eclipse.lsp4j.CompletionItemKind;
import org.netbeans.api.project.Project;
import org.netbeans.modules.java.lsp.server.Utils;
import org.netbeans.spi.project.ProjectConfiguration;
@@ -46,7 +47,7 @@ import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = LaunchConfigurationCompletion.class, position = 100)
public class ProjectConfigurationCompletion implements
LaunchConfigurationCompletion {
- private static final String CONFIG_TYPE = "java8+"; // NOI18N
+ private static final String CONFIG_TYPE = "java+"; // NOI18N
@Override
public CompletableFuture<List<CompletionItem>>
configurations(Supplier<CompletableFuture<Project>> projectSupplier) {
@@ -68,7 +69,7 @@ public class ProjectConfigurationCompletion implements
LaunchConfigurationComple
}
@NbBundle.Messages({"# {0} - Configuration name",
"LBL_LaunchJavaConfig=Launch Java: {0}",
- "# {0} - Configuration name",
"LBL_LaunchJavaConfig_desc=Launch a Java 8+ application using {0}."})
+ "# {0} - Configuration name",
"LBL_LaunchJavaConfig_desc=Launch a Java application using {0}."})
private static List<CompletionItem> createConfigurationsCompletion(Project
p) {
Collection<ProjectConfiguration> configurations = getConfigurations(p);
int size = configurations.size();
@@ -84,7 +85,8 @@ public class ProjectConfigurationCompletion implements
LaunchConfigurationComple
}
String configDisplayName = c.getDisplayName();
String launchName = Bundle.LBL_LaunchJavaConfig(configDisplayName);
- CompletionItem ci = new CompletionItem("Java 8+: " + launchName);
// NOI18N
+ CompletionItem ci = new CompletionItem("Java+: " + launchName);
// NOI18N
+ ci.setKind(CompletionItemKind.Module);
StringWriter sw = new StringWriter();
try (JsonWriter w = new JsonWriter(sw)) {
w.setIndent("\t"); //
NOI18N
diff --git
a/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
b/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
index 9f62b26e51..17e7841824 100644
---
a/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
+++
b/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
@@ -1199,7 +1199,7 @@ public class ServerTest extends NbTestCase {
}
private void checkAttachToPort(DebugConnector c) {
- assertEquals("java8+", c.getType());
+ assertEquals("java+", c.getType());
List<String> arguments = c.getArguments();
assertEquals(2, arguments.size());
assertEquals("hostName", arguments.get(0));
@@ -1208,7 +1208,7 @@ public class ServerTest extends NbTestCase {
}
private void checkAttachToProcess(DebugConnector c) {
- assertEquals("java8+", c.getType());
+ assertEquals("java+", c.getType());
List<String> arguments = c.getArguments();
assertEquals(1, arguments.size());
assertEquals("processId", arguments.get(0));
diff --git a/java/java.lsp.server/vscode/CHANGELOG.md
b/java/java.lsp.server/vscode/CHANGELOG.md
index 7ec3af9fc9..008dd31eca 100644
--- a/java/java.lsp.server/vscode/CHANGELOG.md
+++ b/java/java.lsp.server/vscode/CHANGELOG.md
@@ -20,6 +20,9 @@
under the License.
-->
+## Version 18.0.0
+* Java 8+ launch config renamed to Java+
+
## Version 17.0.301
* nb-javac 20 support
* Gradle support to work on JDK 20
diff --git a/java/java.lsp.server/vscode/README.md
b/java/java.lsp.server/vscode/README.md
index 1fd1beeb06..2d401e928f 100644
--- a/java/java.lsp.server/vscode/README.md
+++ b/java/java.lsp.server/vscode/README.md
@@ -46,7 +46,7 @@ When running this extension on GraalVM, as its runtime JDK,
behind proxy it requ
* HTML5/JavaScript - Templates for JS, HTML, CSS,... files
* Other - various templates for JSON, YAML, properties, ... files
* __Java: Compile Workspace__ - invoke Maven or Gradle build
-* Debugger __Java 8+...__ - start main class or test on JDK8+. More in
[Debugger section](#debugger-and-launch-configurations)
+* Debugger __Java+...__ - start main class or test on selected JDK. More in
[Debugger section](#debugger-and-launch-configurations)
* Progress shown for long running operations with cancel support for selected
types
* __Native Image Debugger__ is a new Run configuration added which allows Java
style debugging of Ahead of Time compiled native-images, produced by GraalVM.
It is experimental feature which works with GDB on Linux. GDB 7.11 or GDB 10.1+
is required due to known issue
[#26139](https://sourceware.org/bugzilla/show_bug.cgi?id=26139) in GDB 8 and 9.
* It is also possible to attach to running native image process using
__Attach to Native Image__ launch configuation.
@@ -60,14 +60,14 @@ Project Explorer provides an overview of logical project
structure, groups sourc

## Debugger and Launch Configurations
-Language Server __Java 8+ ...__ launch configuration supports debugging and
running Java applications using JDK8 or newer.
+Language Server __Java+ ...__ launch configuration supports debugging and
running Java applications using JDK11 or newer.
1. The launch configuration (debugger) is invoked when `Run main | Debug main`
code lense is selected in the code.
-2. Or __Java 8+...__ is selected in __Run and Debug__ activity panel.
+2. Or __Java+...__ is selected in __Run and Debug__ activity panel.

### Launch Configurations
-* __Launch Java 8+ App__ - Debug or Run current Java project
+* __Launch Java App__ - Debug or Run current Java project
* __Launch Java: Continuous Mode__ - Runs Micronaut project and reloads it
when source code has been changed.
-* __Attach to Port__ & __Attach to Process__ - Attach debugger actions.
Available when __Java 8+ ...__ at the bottom of drop down list is selected.
+* __Attach to Port__ & __Attach to Process__ - Attach debugger actions.
Available when __Java+ ...__ at the bottom of drop down list is selected.
* Select this configuration, then click the 
* Select either from available process or enter the port to connect to JVM
running with JDWP.
* __Attach to Shared Memory__ is available on Windows in addtion to above
mentioned _Attach..._
diff --git a/java/java.lsp.server/vscode/package-lock.json
b/java/java.lsp.server/vscode/package-lock.json
index 2a22d0989e..dbda8651ce 100644
--- a/java/java.lsp.server/vscode/package-lock.json
+++ b/java/java.lsp.server/vscode/package-lock.json
@@ -18,7 +18,7 @@
"@types/mocha": "^9.0.0",
"@types/node": "^13.11.0",
"@types/ps-node": "^0.1.0",
- "@types/vscode": "^1.67.0",
+ "@types/vscode": "^1.76.0",
"@vscode/codicons": "0.0.29",
"glob": "^7.1.6",
"mocha": "^9.1.2",
@@ -27,7 +27,7 @@
"vscode-test": "^1.3.0"
},
"engines": {
- "vscode": "^1.67.0"
+ "vscode": "^1.76.0"
}
},
"node_modules/@types/glob": {
@@ -60,9 +60,9 @@
"license": "MIT"
},
"node_modules/@types/vscode": {
- "version": "1.67.0",
- "resolved":
"https://registry.npmjs.org/@types/vscode/-/vscode-1.67.0.tgz",
- "integrity":
"sha512-GH8BDf8cw9AC9080uneJfulhSa7KHSMI2s/CyKePXoGNos9J486w2V4YKoeNUqIEkW4hKoEAWp6/cXTwyGj47g==",
+ "version": "1.77.0",
+ "resolved":
"https://registry.npmjs.org/@types/vscode/-/vscode-1.77.0.tgz",
+ "integrity":
"sha512-MWFN5R7a33n8eJZJmdVlifjig3LWUNRrPeO1xemIcZ0ae0TEQuRc7G2xV0LUX78RZFECY1plYBn+dP/Acc3L0Q==",
"dev": true
},
"node_modules/@ungap/promise-all-settled": {
@@ -1155,9 +1155,9 @@
"dev": true
},
"@types/vscode": {
- "version": "1.67.0",
- "resolved":
"https://registry.npmjs.org/@types/vscode/-/vscode-1.67.0.tgz",
- "integrity":
"sha512-GH8BDf8cw9AC9080uneJfulhSa7KHSMI2s/CyKePXoGNos9J486w2V4YKoeNUqIEkW4hKoEAWp6/cXTwyGj47g==",
+ "version": "1.77.0",
+ "resolved":
"https://registry.npmjs.org/@types/vscode/-/vscode-1.77.0.tgz",
+ "integrity":
"sha512-MWFN5R7a33n8eJZJmdVlifjig3LWUNRrPeO1xemIcZ0ae0TEQuRc7G2xV0LUX78RZFECY1plYBn+dP/Acc3L0Q==",
"dev": true
},
"@ungap/promise-all-settled": {
diff --git a/java/java.lsp.server/vscode/package.json
b/java/java.lsp.server/vscode/package.json
index 76d1199d96..2c53987c18 100644
--- a/java/java.lsp.server/vscode/package.json
+++ b/java/java.lsp.server/vscode/package.json
@@ -22,11 +22,10 @@
"multi-root ready"
],
"engines": {
- "vscode": "^1.67.0"
+ "vscode": "^1.76.0"
},
"activationEvents": [
"onLanguage:java",
- "onCommand:java.workspace.newproject",
"workspaceContains:**/*.java",
"workspaceContains:pom.xml",
"workspaceContains:build.gradle",
@@ -202,22 +201,22 @@
"default": 999,
"minimum": 1
},
- "java8+.runConfig.arguments": {
+ "java+.runConfig.arguments": {
"type": "string",
"default": "",
"description": "Arguments"
},
- "java8+.runConfig.vmOptions": {
+ "java+.runConfig.vmOptions": {
"type": "string",
"default": "",
"description": "VM options"
},
- "java8+.runConfig.env": {
+ "java+.runConfig.env": {
"type": "string",
"default": "",
"description": "Environment variables"
},
- "java8+.runConfig.cwd": {
+ "java+.runConfig.cwd": {
"type": "string",
"default": "",
"description": "Working directory"
@@ -234,8 +233,8 @@
],
"debuggers": [
{
- "type": "java8+",
- "label": "Java 8+",
+ "type": "java+",
+ "label": "Java+",
"runtime": "node",
"when": "config.netbeans.javaSupport.enabled",
"languages": [
@@ -342,19 +341,19 @@
},
"initialConfigurations": [
{
- "type": "java8+",
+ "type": "java+",
"request": "launch",
- "name": "Launch Java 8+ App"
+ "name": "Launch Java App"
}
],
"configurationSnippets": [
{
- "label": "Java 8+: Launch Java
8+ Application",
- "description": "Launch a Java
8+ Application in debug mode",
+ "label": "Java+: Launch Java
Application",
+ "description": "Launch a Java
Application in debug mode",
"body": {
- "type": "java8+",
+ "type": "java+",
"request": "launch",
- "name": "Launch Java 8+
App"
+ "name": "Launch Java
App"
}
}
]
@@ -1044,7 +1043,7 @@
"@types/mocha": "^9.0.0",
"@types/node": "^13.11.0",
"@types/ps-node": "^0.1.0",
- "@types/vscode": "^1.67.0",
+ "@types/vscode": "^1.76.0",
"glob": "^7.1.6",
"mocha": "^9.1.2",
"ps-node": "^0.1.6",
diff --git a/java/java.lsp.server/vscode/src/extension.ts
b/java/java.lsp.server/vscode/src/extension.ts
index 055066c431..d0bdc03abe 100644
--- a/java/java.lsp.server/vscode/src/extension.ts
+++ b/java/java.lsp.server/vscode/src/extension.ts
@@ -382,18 +382,18 @@ export function activate(context: ExtensionContext):
VSNetBeansAPI {
//register debugger:
let debugTrackerFactory =new NetBeansDebugAdapterTrackerFactory();
-
context.subscriptions.push(vscode.debug.registerDebugAdapterTrackerFactory('java8+',
debugTrackerFactory));
+
context.subscriptions.push(vscode.debug.registerDebugAdapterTrackerFactory('java+',
debugTrackerFactory));
let configInitialProvider = new NetBeansConfigurationInitialProvider();
-
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('java8+',
configInitialProvider, vscode.DebugConfigurationProviderTriggerKind.Initial));
+
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('java+',
configInitialProvider, vscode.DebugConfigurationProviderTriggerKind.Initial));
let configDynamicProvider = new
NetBeansConfigurationDynamicProvider(context);
-
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('java8+',
configDynamicProvider, vscode.DebugConfigurationProviderTriggerKind.Dynamic));
+
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('java+',
configDynamicProvider, vscode.DebugConfigurationProviderTriggerKind.Dynamic));
let configResolver = new NetBeansConfigurationResolver();
-
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('java8+',
configResolver));
+
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('java+',
configResolver));
let configNativeResolver = new NetBeansConfigurationNativeResolver();
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('nativeimage',
configNativeResolver));
let debugDescriptionFactory = new NetBeansDebugAdapterDescriptionFactory();
-
context.subscriptions.push(vscode.debug.registerDebugAdapterDescriptorFactory('java8+',
debugDescriptionFactory));
+
context.subscriptions.push(vscode.debug.registerDebugAdapterDescriptorFactory('java+',
debugDescriptionFactory));
context.subscriptions.push(vscode.debug.registerDebugAdapterDescriptorFactory('nativeimage',
debugDescriptionFactory));
// register content provider
@@ -403,7 +403,7 @@ export function activate(context: ExtensionContext):
VSNetBeansAPI {
// initialize Run Configuration
initializeRunConfiguration().then(initialized => {
if (initialized) {
-
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('java8+',
runConfigurationProvider));
+
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('java+',
runConfigurationProvider));
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('java',
runConfigurationProvider));
context.subscriptions.push(vscode.window.registerTreeDataProvider('run-config',
runConfigurationNodeProvider));
context.subscriptions.push(vscode.commands.registerCommand('java.workspace.configureRunSettings',
(...params: any[]) => {
@@ -537,7 +537,7 @@ export function activate(context: ExtensionContext):
VSNetBeansAPI {
if (docUri) {
const workspaceFolder =
vscode.workspace.getWorkspaceFolder(docUri);
const debugConfig : vscode.DebugConfiguration = {
- type: "java8+",
+ type: "java+",
name: "Java Single Debug",
request: "launch",
methodName,
@@ -591,6 +591,8 @@ export function activate(context: ExtensionContext):
VSNetBeansAPI {
return client;
}));
+ launchConfigurations.updateLaunchConfig();
+
// register completions:
launchConfigurations.registerCompletion(context);
return Object.freeze({
@@ -1336,7 +1338,7 @@ class NetBeansConfigurationInitialProvider implements
vscode.DebugConfigurationP
}
const debugConfig : vscode.DebugConfiguration = {
name: cname,
- type: "java8+",
+ type: "java+",
request: "launch",
launchConfiguration: cn,
};
@@ -1410,7 +1412,7 @@ class NetBeansConfigurationResolver implements
vscode.DebugConfigurationProvider
resolveDebugConfiguration(_folder: vscode.WorkspaceFolder | undefined,
config: vscode.DebugConfiguration, _token?: vscode.CancellationToken):
vscode.ProviderResult<vscode.DebugConfiguration> {
if (!config.type) {
- config.type = 'java8+';
+ config.type = 'java+';
}
if (!config.request) {
config.request = 'launch';
diff --git a/java/java.lsp.server/vscode/src/launchConfigurations.ts
b/java/java.lsp.server/vscode/src/launchConfigurations.ts
index 48006b5a2e..f5f13ee9c7 100644
--- a/java/java.lsp.server/vscode/src/launchConfigurations.ts
+++ b/java/java.lsp.server/vscode/src/launchConfigurations.ts
@@ -18,9 +18,55 @@
*/
'use strict';
-import { commands, CompletionItem, CompletionList, ExtensionContext,
languages, ProviderResult, SnippetString } from 'vscode';
+import { commands, CompletionItem, CompletionList, ExtensionContext,
languages, ProviderResult, SnippetString, window, workspace } from 'vscode';
import { InsertTextFormat } from 'vscode-languageclient';
import * as jsoncp from 'jsonc-parser';
+import * as fs from 'fs';
+
+export function updateLaunchConfig() {
+ workspace.findFiles('.vscode/launch.json').then(async files => {
+ const updateOption = 'Update the existing launch.json file(s)';
+ let selection: any = undefined;
+ for (const file of files) {
+ let edits: jsoncp.Edit[] = [];
+ const content = fs.readFileSync(file.fsPath, 'utf8');
+ const root = jsoncp.parseTree(content);
+ root?.children?.forEach(rch => {
+ if (rch.type === 'property' && rch.children?.length === 2) {
+ const name = rch.children[0].type === 'string' ?
rch.children[0].value : undefined;
+ if (name === 'configurations' && rch.children[1].type ===
'array') {
+ rch.children[1].children?.forEach(config => {
+ if (config.type === 'object') {
+ config.children?.forEach(cch => {
+ if (cch.type === 'property' &&
cch.children?.length === 2) {
+ const cname = cch.children[0].type ===
'string' ? cch.children[0].value : undefined;
+ if (cname === 'type' &&
cch.children[1].type === 'string' && cch.children[1].value === 'java8+') {
+ const path =
jsoncp.getNodePath(cch.children[1]);
+ if (path) {
+ edits =
edits.concat(jsoncp.modify(content, path, 'java+', {}));
+ }
+ }
+ }
+ });
+ }
+ });
+ }
+ }
+ });
+ const newContent = jsoncp.applyEdits(content, edits);
+ if (newContent !== content) {
+ if (!selection) {
+ selection = await window.showWarningMessage('Java 8+ debug
configuration has been renamed to Java+', updateOption);
+ }
+ if (selection === updateOption) {
+ fs.writeFileSync(file.fsPath, newContent);
+ } else {
+ return;
+ }
+ }
+ };
+ });
+}
export function registerCompletion(context: ExtensionContext) {
context.subscriptions.push(languages.registerCompletionItemProvider({
language: 'jsonc', pattern: '**/launch.json' }, {
@@ -55,15 +101,13 @@ export function registerCompletion(context:
ExtensionContext) {
completionItems =
commands.executeCommand('java.project.configuration.completion', uri,
attributesMap);
}
}
-
-
- return (completionItems as
Thenable<CompletionList<CompletionItem>>).then(itemsList => {
+ return (completionItems as
Thenable<CompletionList<CompletionItem>>).then(itemsList => {
let items = itemsList.items;
- if (!items) {
+ if (!items) {
items = ((itemsList as unknown) as
CompletionItem[]);
- }
+ }
addCommas(sourceText, offset, items);
- return new CompletionList(items);
+ return new CompletionList(items);
});
}
}
@@ -72,20 +116,6 @@ export function registerCompletion(context:
ExtensionContext) {
}));
}
-function getAttributesMap(node: jsoncp.Node) {
- let attributes = new Map<string, object>();
- if (node.children) {
- for (let index in node.children) {
- let ch = node.children[index];
- let prop = ch.children;
- if (prop) {
- attributes.set(prop[0].value, prop[1].value);
- }
- }
- }
- return attributes;
-}
-
function getAttributes(node: jsoncp.Node) {
let attributes: any = {};
if (node.children) {
@@ -136,7 +166,7 @@ function addCommas(sourceText: string, offset: number,
completionItems: Completi
if (append) {
snippet.value = snippet.value + ',';
}
- } else {
+ } else {
if (prepend) {
ci.insertText = ',' + ci.insertText;
}
@@ -145,6 +175,9 @@ function addCommas(sourceText: string, offset: number,
completionItems: Completi
}
}
}
+ if (ci.kind) {
+ ci.kind--; // Note difference between vscode's CompletionItemKind
and lsp's CompletionItemKind
+ }
}
}
diff --git a/java/java.lsp.server/vscode/src/runConfiguration.ts
b/java/java.lsp.server/vscode/src/runConfiguration.ts
index c4ec09613a..e6b148ae93 100644
--- a/java/java.lsp.server/vscode/src/runConfiguration.ts
+++ b/java/java.lsp.server/vscode/src/runConfiguration.ts
@@ -171,7 +171,7 @@ class RunConfigurationNode extends vscode.TreeItem {
}
getConfig(): vscode.WorkspaceConfiguration {
- return vscode.workspace.getConfiguration('java8+.runConfig');
+ return vscode.workspace.getConfiguration('java+.runConfig');
}
}
diff --git a/java/java.lsp.server/vscode/src/test/suite/extension.test.ts
b/java/java.lsp.server/vscode/src/test/suite/extension.test.ts
index ef0dad3f42..01aec1c16e 100644
--- a/java/java.lsp.server/vscode/src/test/suite/extension.test.ts
+++ b/java/java.lsp.server/vscode/src/test/suite/extension.test.ts
@@ -164,7 +164,7 @@ suite('Extension Test Suite', () => {
}
console.log("Test: invoking debug debug.run");
const workspaceFolder =
(vscode.workspace.workspaceFolders!)[0];
- vscode.debug.startDebugging(workspaceFolder, {type: "java8+",
name: "Launch Java 8+ App", request: "launch"}, {}).
+ vscode.debug.startDebugging(workspaceFolder, {type: "java+",
name: "Launch Java App", request: "launch"}, {}).
then(() => waitUserApplication(5, true, onProcessStarted));
});
return r;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists