Conversation
Signed-off-by: xuzho <xuzho@microsoft.com>
| config.sourcePath = [cur]; | ||
| config.cwd = cur; | ||
| config.stopOnEntry = true; | ||
| await runJavaC(fullpath, cur).then(function () { |
| declare let v8debug; | ||
| const DEBUG = (typeof v8debug === 'object') || startedInDebugMode(); | ||
| let electron = require('./electron_j'); | ||
| let cp = require('child_process'); |
| resolve(); | ||
| } | ||
| else { | ||
| reject(code); |
There was a problem hiding this comment.
have you tested the multiple reject scenario
There was a problem hiding this comment.
reject handler would send the error to vscode panel, rethink about it, i think it is ok to reject in both of the two event handlers as only on would hit
| const fullpath = editor.document.fileName; | ||
| const cur = path.parse(fullpath).dir; | ||
| config.startupClass = path.parse(fullpath).base.slice(0, -5); | ||
| config.sourcePath = [cur]; |
There was a problem hiding this comment.
when the single file defines the package name, and the config.sourcePath option you give will also contain the package path. Not sure if the DebugAdapter can infer the right file path when the breakpoint occurs. Did you test this case?
There was a problem hiding this comment.
i think we only support default package for single file?
There was a problem hiding this comment.
for single file debug, the file is linked to default project under src/[package]. so if we support non-default package, we also need to support user to change package name, i don't think we can do that as we cannot create working copy for .project file
Signed-off-by: xuzho <xuzho@microsoft.com>
58142c2 to
39612c3
Compare
| }); | ||
| // rethrow to disrupt the chain. | ||
| throw error; | ||
| }).then(requirements => { |
There was a problem hiding this comment.
For convention, then should before catch.
| throw error; | ||
| }).then(requirements => { | ||
| return new Promise(function(resolve, reject) { | ||
| let child = path.resolve(requirements.java_home + '/bin/javac'); |
| import { workspace, ExtensionContext, window, StatusBarAlignment, commands, ViewColumn, Uri, CancellationToken, TextDocumentContentProvider, TextEditor, WorkspaceConfiguration, languages, IndentAction, ProgressLocation, Progress } from 'vscode'; | ||
| import { LanguageClient, LanguageClientOptions, Position as LSPosition, Location as LSLocation } from 'vscode-languageclient'; | ||
| import { runServer, awaitServerConnection } from './javaServerStarter'; | ||
| import { runServer, awaitServerConnection, runJavaC } from './javaServerStarter'; |
There was a problem hiding this comment.
javac is a common execution file. doesn't need upper case the the C
| if (editor && editor.document.languageId === 'java') { | ||
| const fullpath = editor.document.fileName; | ||
| const cur = path.parse(fullpath).dir; | ||
| config.startupClass = path.parse(fullpath).base.slice(0, -5); |
There was a problem hiding this comment.
user path.basename(path[, ext]) to get base name of xxx.java.
https://nodejs.org/api/path.html#path_path_basename_path_ext
| const editor = vscode.window.activeTextEditor; | ||
| if (editor && editor.document.languageId === 'java') { | ||
| const fullpath = editor.document.fileName; | ||
| const cur = path.parse(fullpath).dir; |
There was a problem hiding this comment.
use path.dirname(path) to get dir name.
https://nodejs.org/api/path.html#path_path_dirname_path
Signed-off-by: xuzho <xuzho@microsoft.com>
Signed-off-by: xuzho xuzho@microsoft.com