Skip to content

Commit 38129b8

Browse files
committed
Addressed review comments
1 parent 2043e39 commit 38129b8

File tree

13 files changed

+41
-33
lines changed

13 files changed

+41
-33
lines changed

vscode/l10n/bundle.l10n.en.json

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

vscode/src/commands/cache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const deleteCache = async () => {
3333
if (userDir && fs.existsSync(userDir)) {
3434
const yes = l10n.value("jdk.extension.cache.label.confirmation.yes")
3535
const cancel = l10n.value("jdk.extension.cache.label.confirmation.cancel")
36-
const confirmation = await window.showInformationMessage('Are you sure you want to delete cache for this workspace and reload the window ?',
36+
const confirmation = await window.showInformationMessage(l10n.value("jdk.extension.cache.message.confirmToDeleteCache"),
3737
yes, cancel);
3838
if (confirmation === yes) {
3939
const reloadWindowActionLabel = l10n.value("jdk.extension.cache.label.reloadWindow");

vscode/src/commands/commands.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const extCommands = {
4848
selectEditorProjs: appendPrefixToCommand('select.editor.projects'),
4949
attachDebugger: appendPrefixToCommand("java.attachDebugger.connector"),
5050
loadWorkspaceTests: appendPrefixToCommand("load.workspace.tests"),
51-
projectDeleteEntry: "javals.foundProjects.deleteEntry"
51+
projectDeleteEntry: appendPrefixToCommand("foundProjects.deleteEntry")
5252
}
5353

5454
export const builtInCommands = {
@@ -78,5 +78,8 @@ export const nbCommands = {
7878
debuggerConfigurations: appendPrefixToCommand('java.attachDebugger.configurations'),
7979
runProjectAction: appendPrefixToCommand('project.run.action'),
8080
buildWorkspace: appendPrefixToCommand('build.workspace'),
81-
cleanWorkspace: appendPrefixToCommand('clean.workspace')
81+
cleanWorkspace: appendPrefixToCommand('clean.workspace'),
82+
clearProjectCaches: appendPrefixToCommand('clear.project.caches'),
83+
javaProjectPackages: appendPrefixToCommand('java.get.project.packages'),
84+
openStackTrace: appendPrefixToCommand('open.stacktrace')
8285
}

vscode/src/configurations/configuration.ts

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

vscode/src/configurations/handlers.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
import { extensions, workspace } from "vscode";
16+
17+
import { extensions, workspace, WorkspaceConfiguration } from "vscode";
1718
import { builtInConfigKeys, configKeys } from "./configuration";
1819
import { extConstants, NODE_WINDOWS_LABEL } from "../constants";
1920
import * as os from 'os';
@@ -22,6 +23,10 @@ import { LOGGER } from "../logger";
2223
import * as path from 'path';
2324
import * as fs from 'fs';
2425

26+
export const getConfiguration = (key: string = extConstants.COMMAND_PREFIX): WorkspaceConfiguration => {
27+
return workspace.getConfiguration(key);
28+
}
29+
2530
export const getConfigurationValue = <T>(key: string, defaultValue: T | undefined = undefined): T => {
2631
const conf = workspace.getConfiguration(extConstants.COMMAND_PREFIX);
2732
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?.getProcess();
87+
if (process != null) {
88+
process?.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
@@ -30,15 +30,18 @@ export class ExtensionLogger {
3030
}
3131

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

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

4042
public error(message: string): void {
41-
this.outChannel.appendLine(`[${LogLevel.ERROR}]: ${message}`);
43+
const formattedMessage = `[${LogLevel.ERROR}]: ${message}`;
44+
this.printLog(formattedMessage);
4245
}
4346

4447
public logNoNL(message: string): void {
@@ -56,6 +59,11 @@ export class ExtensionLogger {
5659
public dispose(): void {
5760
this.outChannel.dispose();
5861
}
62+
63+
private printLog(message: string): void{
64+
const timestamp = new Date().toISOString();
65+
this.outChannel.appendLine(`[${timestamp}] ${message}`);
66+
}
5967
}
6068

6169
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
@@ -62,8 +62,8 @@ export class NbLanguageClient extends LanguageClient {
6262
'wantsJavaSupport': true,
6363
'wantsGroovySupport': false,
6464
'commandPrefix': extConstants.COMMAND_PREFIX,
65-
'configurationPrefix': 'jdk.',
66-
'altConfigurationPrefix': 'jdk.'
65+
'configurationPrefix': `${extConstants.COMMAND_PREFIX}.`,
66+
'altConfigurationPrefix': `${extConstants.COMMAND_PREFIX}.`
6767
}
6868
},
6969
errorHandler: {

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)