Skip to content

Commit 35d6776

Browse files
committed
Addressed review comments
1 parent 274adad commit 35d6776

File tree

13 files changed

+39
-49
lines changed

13 files changed

+39
-49
lines changed

vscode/l10n/bundle.l10n.en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"jdk.extension.fileSelector.label.testFilesOrSourceFiles": "Test files or source files associated to each other",
4747
"jdk.extension.fileSelector.label.noFileSelected": "No file selected",
4848
"jdk.extension.fileSelector.label.noTestFound": "No Test or Tested class found",
49-
"jdk.extension.cache.message.confirmToDeleteCache": "Are you sure you want to delete cache for this workspace and reload the window ?",
49+
"jdk.extension.cache.message.confirmToDeleteCache": "Are you sure you want to delete the cache for this workspace and reload the window?",
5050
"jdk.extension.cache.label.confirmation.yes":"Yes",
5151
"jdk.extension.cache.label.confirmation.cancel":"Cancel",
5252
"jdk.extension.cache.message.cacheCleared":"Cache cleared successfully for this workspace",

vscode/src/commands/commands.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,8 @@ export const nbCommands = {
7979
debuggerConfigurations: appendPrefixToCommand('java.attachDebugger.configurations'),
8080
runProjectAction: appendPrefixToCommand('project.run.action'),
8181
buildWorkspace: appendPrefixToCommand('build.workspace'),
82-
cleanWorkspace: appendPrefixToCommand('clean.workspace')
82+
cleanWorkspace: appendPrefixToCommand('clean.workspace'),
83+
clearProjectCaches: appendPrefixToCommand('clear.project.caches'),
84+
javaProjectPackages: appendPrefixToCommand('java.get.project.packages'),
85+
openStackTrace: appendPrefixToCommand('open.stacktrace')
8386
}

vscode/src/configurations/configuration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const configKeys = {
2525
formatPrefs: 'format',
2626
hintPrefs: 'hints',
2727
importPrefs: 'java.imports',
28+
runConfig: 'runCofig',
2829
runConfigVmOptions: 'runConfig.vmOptions',
2930
runConfigCwd: 'runConfig.cwd',
3031
verbose: 'verbose',

vscode/src/configurations/handlers.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17-
import { extensions, workspace } from "vscode";
17+
import { extensions, workspace, WorkspaceConfiguration } from "vscode";
1818
import { builtInConfigKeys, configKeys } from "./configuration";
1919
import { extConstants, NODE_WINDOWS_LABEL } from "../constants";
2020
import * as os from 'os';
@@ -23,6 +23,10 @@ import { LOGGER } from "../logger";
2323
import * as path from 'path';
2424
import * as fs from 'fs';
2525

26+
export const getConfiguration = (key: string = extConstants.COMMAND_PREFIX): WorkspaceConfiguration => {
27+
return workspace.getConfiguration(key);
28+
}
29+
2630
export const getConfigurationValue = <T>(key: string, defaultValue: T | undefined = undefined): T => {
2731
const conf = workspace.getConfiguration(extConstants.COMMAND_PREFIX);
2832
return defaultValue != undefined ? conf.get(key, defaultValue) : conf.get(key) as T;

vscode/src/debugger/debugger.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export function registerDebugger(context: ExtensionContext): void {
3636
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider(extConstants.COMMAND_PREFIX, configDynamicProvider, vscode.DebugConfigurationProviderTriggerKind.Dynamic));
3737
let configResolver = new NetBeansConfigurationResolver();
3838
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider(extConstants.COMMAND_PREFIX, configResolver));
39-
context.subscriptions.push(vscode.debug.onDidTerminateDebugSession(((session) => onDidTerminateSession(session))));
4039
let debugDescriptionFactory = new NetBeansDebugAdapterDescriptionFactory();
4140
context.subscriptions.push(vscode.debug.registerDebugAdapterDescriptorFactory(extConstants.COMMAND_PREFIX, debugDescriptionFactory));
4241
initializeRunConfiguration().then(initialized => {
@@ -267,14 +266,3 @@ class RunConfigurationProvider implements vscode.DebugConfigurationProvider {
267266
}
268267

269268
}
270-
271-
272-
function onDidTerminateSession(session: vscode.DebugSession): any {
273-
const config = session.configuration;
274-
if (config.env) {
275-
const file = config.env["MICRONAUT_CONFIG_FILES"];
276-
if (file) {
277-
vscode.workspace.fs.delete(vscode.Uri.file(file));
278-
}
279-
}
280-
}

vscode/src/extension.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ export function activate(context: ExtensionContext): VSNetBeansAPI {
8383

8484

8585
export function deactivate(): Thenable<void> {
86-
if (globalVars.nbProcessManager?.getProcess() != null) {
87-
globalVars.nbProcessManager?.getProcess()?.kill();
86+
const process = globalVars.nbProcessManager;
87+
if (process?.getProcess() != null) {
88+
process?.getProcess()?.kill();
8889
}
8990
return globalVars.clientPromise.stopClient();
9091
}

vscode/src/logger.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,18 @@ export class ExtensionLogger {
3131
}
3232

3333
public log(message: string): void {
34-
this.outChannel.appendLine(`[${LogLevel.INFO}]: ${message}`);
34+
const formattedMessage = `[${LogLevel.INFO}]: ${message}`;
35+
this.printLog(formattedMessage);
3536
}
3637

3738
public warn(message: string): void {
38-
this.outChannel.appendLine(`[${LogLevel.WARN}]: ${message}`);
39+
const formattedMessage = `[${LogLevel.WARN}]: ${message}`;
40+
this.printLog(formattedMessage);
3941
}
4042

4143
public error(message: string): void {
42-
this.outChannel.appendLine(`[${LogLevel.ERROR}]: ${message}`);
44+
const formattedMessage = `[${LogLevel.ERROR}]: ${message}`;
45+
this.printLog(formattedMessage);
4346
}
4447

4548
public logNoNL(message: string): void {
@@ -57,6 +60,11 @@ export class ExtensionLogger {
5760
public dispose(): void {
5861
this.outChannel.dispose();
5962
}
63+
64+
private printLog(message: string): void{
65+
const timestamp = new Date().toISOString();
66+
this.outChannel.appendLine(`[${timestamp}] ${message}`);
67+
}
6068
}
6169

6270
export const LOGGER = new ExtensionLogger(extConstants.SERVER_NAME);

vscode/src/lsp/nbLanguageClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ export class NbLanguageClient extends LanguageClient {
6363
'wantsJavaSupport': true,
6464
'wantsGroovySupport': false,
6565
'commandPrefix': extConstants.COMMAND_PREFIX,
66-
'configurationPrefix': 'jdk.',
67-
'altConfigurationPrefix': 'jdk.'
66+
'configurationPrefix': `${extConstants.COMMAND_PREFIX}.`,
67+
'altConfigurationPrefix': `${extConstants.COMMAND_PREFIX}.`
6868
}
6969
},
7070
errorHandler: {

vscode/src/test/launchNbcode.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,7 @@ import * as os from 'os';
44
import { env } from 'process';
55
import { ChildProcessByStdio, spawn } from 'child_process';
66
import { Readable } from 'stream';
7-
8-
const findNbcode = (extensionPath: string): string => {
9-
let nbcode = os.platform() === 'win32' ?
10-
os.arch() === 'x64' ? 'nbcode64.exe' : 'nbcode.exe'
11-
: 'nbcode.sh';
12-
let nbcodePath = path.join(extensionPath, "nbcode", "bin", nbcode);
13-
14-
let nbcodePerm = fs.statSync(nbcodePath);
15-
if (!nbcodePerm.isFile()) {
16-
throw `Cannot execute ${nbcodePath}`;
17-
}
18-
if (os.platform() !== 'win32') {
19-
fs.chmodSync(path.join(extensionPath, "nbcode", "bin", nbcode), "744");
20-
fs.chmodSync(path.join(extensionPath, "nbcode", "platform", "lib", "nbexec.sh"), "744");
21-
fs.chmodSync(path.join(extensionPath, "nbcode", "java", "maven", "bin", "mvn.sh"), "744");
22-
}
23-
return nbcodePath;
24-
}
7+
import { findNbcode } from '../lsp/utils';
258

269
if (typeof process === 'object' && process.argv0 === 'node') {
2710
let extension = path.join(process.argv[1], '..', '..', '..');

vscode/src/test/suite/general/extension.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import * as myExplorer from '../../../views/projects';
3030
import { CodeAction, commands, extensions, Selection, Uri, window, workspace, TreeItem } from 'vscode';
3131
import { assertWorkspace, awaitClient, dumpJava, findClusters, getFilePaths, openFile, prepareProject, replaceCode } from '../../testutils';
3232
import { FORMATTED_POM_XML, SAMPLE_CODE_FORMAT_DOCUMENT, SAMPLE_CODE_SORT_IMPORTS, SAMPLE_CODE_UNUSED_IMPORTS } from '../../constants';
33-
import { extConstants } from '../../../constants';
33+
import { extCommands } from '../../../commands/commands';
3434

3535
suite('Extension Test Suite', function () {
3636
window.showInformationMessage('Start all tests.');
@@ -166,7 +166,7 @@ suite('Extension Test Suite', function () {
166166
if (refactorActions && refactorActions.length > 0) {
167167
for await (const action of refactorActions) {
168168
if (action.command && action.command.arguments) {
169-
if (action.command.command === extConstants.COMMAND_PREFIX + ".surround.with") {
169+
if (action.command.command === extCommands.surroundWith) {
170170
//this action has a popup where the user needs to
171171
//select a template that should be used for the surround:
172172
continue;
@@ -197,7 +197,7 @@ suite('Extension Test Suite', function () {
197197
assert.strictEqual(tests[1].tests[0].name, 'testTrue', `Invalid test name returned`);
198198

199199
console.log("Test: run all workspace tests");
200-
await vscode.commands.executeCommand(extConstants.COMMAND_PREFIX + '.run.test', workspaceFolder.uri.toString());
200+
await vscode.commands.executeCommand(extCommands.runTest, workspaceFolder.uri.toString());
201201
console.log(`Test: run all workspace tests finished`);
202202
} catch (error) {
203203
dumpJava();

0 commit comments

Comments
 (0)