Skip to content
Merged
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
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Tab indentation
[*]
indent_style = space
indent_size = 4

# The indent size used in the `package.json` file cannot be changed
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
[{.travis.yml,npm-shrinkwrap.json,package.json}]
indent_size = 2

[vendor/**.js]
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
out
bin
server
node_modules
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A lightweight Java Debugger based on [Java Debug Server](https://github.com/Micr
- Threads
- Debug console

## Use
## Usage

- Launch VS Code
- Open a Java project (Maven/Gradle/Eclipse)
Expand Down
16 changes: 14 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ gulp.task('build_server', () => {
.pipe(gulp.dest('.'));
});

function isWin() {
return /^win/.test(process.platform);
}

function isMac() {
return /^darwin/.test(process.platform);
}

function isLinux() {
return /^linux/.test(process.platform);
}

function mvnw() {
return "mvn";
}
return isWin()?"mvnw.cmd":"./mvnw";
}
9 changes: 6 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,28 @@ export function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand(commands.JAVA_START_DEBUGSESSION, async (config) => {
if (config.request === "launch") {
if (!config.mainClass) {
vscode.window.showErrorMessage("Please specify the main class in launch.json.");
vscode.window.showErrorMessage("Please specify the mainClass in the launch.json.");
return;
} else if (!config.classPaths || !Array.isArray(config.classPaths) || !config.classPaths.length) {
config.classPaths = await resolveClasspath(config.mainClass, config.projectName);
}
if (!config.classPaths || !Array.isArray(config.classPaths) || !config.classPaths.length) {
vscode.window.showErrorMessage("Cannot resolve the classpaths automatically, please specify it in launch.json.");
vscode.window.showErrorMessage("Cannot resolve the classpaths automatically, please specify the value in the launch.json.");
return;
}
} else if (config.request === "attach") {
if (!config.hostName || !config.port) {
vscode.window.showErrorMessage("Please specify the host name and the port of the remote debuggee in launch.json.");
vscode.window.showErrorMessage("Please specify the host name and the port of the remote debuggee in the launch.json.");
return;
}
}
const debugServerPort = await startDebugSession();
if (debugServerPort) {
config.debugServer = debugServerPort;
vscode.commands.executeCommand(commands.VSCODE_STARTDEBUG, config);
} else {
// Information for diagnostic:
console.log("Cannot find a port for debugging session");
}
});
}
Expand Down
13 changes: 9 additions & 4 deletions test/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ import * as myExtension from "../src/extension";
// Defines a Mocha test suite to group tests of similar kind together
suite("Extension Tests", () => {

// Defines a Mocha unit test
test("Something 1", () => {
assert.equal(-1, [1, 2, 3].indexOf(5));
assert.equal(-1, [1, 2, 3].indexOf(0));
test("Extension should be present", () => {
assert.ok(vscode.extensions.getExtension("Microsoft.vscode-java-debug"));
});

test("should activate", function() {
this.timeout(1 * 60 * 1000);
return vscode.extensions.getExtension("Microsoft.vscode-java-debug").activate().then((api) => {
assert.ok(true);
});
});
});
3 changes: 2 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
true,
150
],
"no-angle-bracket-type-assertion": false
"no-angle-bracket-type-assertion": false,
"no-console": ["log","error"]
}
}