Skip to content

Commit

Permalink
Remove requirement for Java file to support debug attach from anywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
dansomething committed Feb 20, 2024
1 parent a3eca5a commit 44a818a
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,16 @@ async function startVimspector(...args: any[]): Promise<any> {
window.showInformationMessage(msg);

const mainMethod = await resolveMainMethodCurrentFile();
if (!mainMethod) {
window.showErrorMessage(`A Java file must be active for :CocCommand ${Commands.JAVA_DEBUG_VIMSPECTOR_START}`);
return Promise.resolve();
const mainClass = mainMethod?.mainClass;
const projectName = mainMethod?.projectName;
let modulePaths: string | undefined = undefined;
let classPaths: string | undefined = undefined;
if (mainMethod) {
const classPathMainMethod = await resolveClassPathMainMethod(mainMethod);
// See https://puremourning.github.io/vimspector/configuration.html#the-splat-operator
modulePaths = classPathMainMethod?.modulePaths.join(' ');
classPaths = classPathMainMethod?.classPaths.join(' ');
}
const mainClass = mainMethod.mainClass;
const projectName = mainMethod.projectName;
const classPathMainMethod = await resolveClassPathMainMethod(mainMethod);

// See https://puremourning.github.io/vimspector/configuration.html#the-splat-operator
const modulePaths = classPathMainMethod.modulePaths.join(' ');
const classPaths = classPathMainMethod.classPaths.join(' ');

const debugConfig = workspace.getConfiguration('java.debug');
// See package.json#configuration.properties
Expand Down

0 comments on commit 44a818a

Please sign in to comment.