Skip to content

Commit 358a0e4

Browse files
authored
Refine codebase. (microsoft#13)
1 parent c2038df commit 358a0e4

7 files changed

Lines changed: 51 additions & 11 deletions

File tree

‎.editorconfig‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Tab indentation
7+
[*]
8+
indent_style = space
9+
indent_size = 4
10+
11+
# The indent size used in the `package.json` file cannot be changed
12+
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
13+
[{.travis.yml,npm-shrinkwrap.json,package.json}]
14+
indent_size = 2
15+
16+
[vendor/**.js]
17+
indent_style = space
18+
indent_size = 2

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
out
22
bin
3+
server
34
node_modules

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A lightweight Java Debugger based on [Java Debug Server](https://github.com/Micr
1515
- Threads
1616
- Debug console
1717

18-
## Use
18+
## Usage
1919

2020
- Launch VS Code
2121
- Open a Java project (Maven/Gradle/Eclipse)

‎gulpfile.js‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ gulp.task('build_server', () => {
2323
.pipe(gulp.dest('.'));
2424
});
2525

26+
function isWin() {
27+
return /^win/.test(process.platform);
28+
}
29+
30+
function isMac() {
31+
return /^darwin/.test(process.platform);
32+
}
33+
34+
function isLinux() {
35+
return /^linux/.test(process.platform);
36+
}
37+
2638
function mvnw() {
27-
return "mvn";
28-
}
39+
return isWin()?"mvnw.cmd":"./mvnw";
40+
}

‎src/extension.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,28 @@ export function activate(context: vscode.ExtensionContext) {
66
vscode.commands.registerCommand(commands.JAVA_START_DEBUGSESSION, async (config) => {
77
if (config.request === "launch") {
88
if (!config.mainClass) {
9-
vscode.window.showErrorMessage("Please specify the main class in launch.json.");
9+
vscode.window.showErrorMessage("Please specify the mainClass in the launch.json.");
1010
return;
1111
} else if (!config.classPaths || !Array.isArray(config.classPaths) || !config.classPaths.length) {
1212
config.classPaths = await resolveClasspath(config.mainClass, config.projectName);
1313
}
1414
if (!config.classPaths || !Array.isArray(config.classPaths) || !config.classPaths.length) {
15-
vscode.window.showErrorMessage("Cannot resolve the classpaths automatically, please specify it in launch.json.");
15+
vscode.window.showErrorMessage("Cannot resolve the classpaths automatically, please specify the value in the launch.json.");
1616
return;
1717
}
1818
} else if (config.request === "attach") {
1919
if (!config.hostName || !config.port) {
20-
vscode.window.showErrorMessage("Please specify the host name and the port of the remote debuggee in launch.json.");
20+
vscode.window.showErrorMessage("Please specify the host name and the port of the remote debuggee in the launch.json.");
2121
return;
2222
}
2323
}
2424
const debugServerPort = await startDebugSession();
2525
if (debugServerPort) {
2626
config.debugServer = debugServerPort;
2727
vscode.commands.executeCommand(commands.VSCODE_STARTDEBUG, config);
28+
} else {
29+
// Information for diagnostic:
30+
console.log("Cannot find a port for debugging session");
2831
}
2932
});
3033
}

‎test/extension.test.ts‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@ import * as myExtension from "../src/extension";
1414
// Defines a Mocha test suite to group tests of similar kind together
1515
suite("Extension Tests", () => {
1616

17-
// Defines a Mocha unit test
18-
test("Something 1", () => {
19-
assert.equal(-1, [1, 2, 3].indexOf(5));
20-
assert.equal(-1, [1, 2, 3].indexOf(0));
17+
test("Extension should be present", () => {
18+
assert.ok(vscode.extensions.getExtension("Microsoft.vscode-java-debug"));
19+
});
20+
21+
test("should activate", function() {
22+
this.timeout(1 * 60 * 1000);
23+
return vscode.extensions.getExtension("Microsoft.vscode-java-debug").activate().then((api) => {
24+
assert.ok(true);
25+
});
2126
});
2227
});

‎tslint.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
true,
3232
150
3333
],
34-
"no-angle-bracket-type-assertion": false
34+
"no-angle-bracket-type-assertion": false,
35+
"no-console": ["log","error"]
3536
}
3637
}

0 commit comments

Comments
 (0)