Repository navigation
Validate mainClass and projectName configs - #205
Conversation
Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
|
|
||
| public class ResolveMainClassHandler { | ||
| private static final Logger logger = Logger.getLogger(Configuration.LOGGER_NAME); | ||
| private static final String CLASSNAME_REGX = "([$\\w]+\\.)*[$\\w]+"; |
There was a problem hiding this comment.
I think a better way is to validate the main Class in js side, the java side only exposure ways of querying java projects and main classes.
There was a problem hiding this comment.
I don't want to separate the validation logic to two parts, that's hard for reading. JS side is responsible for UI related logic, and JAVA side is for computing the result.
| } else if (UPDATE_DEBUG_SETTINGS.equals(commandId)) { | ||
| return DebugSettingUtils.configDebugSettings(arguments); | ||
| } else if (VALIDATE_LAUNCHCONFIG.equals(commandId)) { | ||
| return new ResolveMainClassHandler().validateLaunchConfig(arguments); |
There was a problem hiding this comment.
How about make class ResolveMainClassHandler a utility class(with a changed name) and not new ResolveMainClassHandler every time
There was a problem hiding this comment.
i guess the original habit is inherited from jdt.ls handler implementation. If we just refactor this one, it will be a little weird, because ResolveClasspathsHandler has similar issue. So i prefer to keep the current convention.
| List<ResolutionItem> proposals = resolveMainClassCore(arguments); | ||
|
|
||
| Collections.sort(proposals, new ProposalItemComparator((ResolutionItem item) -> { | ||
| if (item.mainClass.equals(mainClass)) { |
There was a problem hiding this comment.
Objects.equals
There was a problem hiding this comment.
Nice suggestions.
Signed-off-by: Jinbo Wang jinbwan@microsoft.com
The requirement is from issue microsoft/vscode-java-debug#355