-
Notifications
You must be signed in to change notification settings - Fork 774
[READY] Support Java extensions, in particular the java debugger #1263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 6 of 6 files at r1.
Reviewable status: 0 of 2 LGTMs obtained
ac432b5
to
fb8927b
Compare
Codecov Report
@@ Coverage Diff @@
## master #1263 +/- ##
==========================================
- Coverage 97.39% 97.14% -0.26%
==========================================
Files 95 95
Lines 7294 7343 +49
Branches 153 153
==========================================
+ Hits 7104 7133 +29
- Misses 149 169 +20
Partials 41 41 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is JDT the odd one out or would there be any possible benefit to making this more general?
Reviewed 4 of 6 files at r1, 2 of 2 files at r2.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @puremourning)
ycmd/default_settings.json, line 36 at r2 (raw file):
"clangd_args": [], "clangd_uses_ycmd_caching": 1, "java_jdtls_extension_path": []
Why is this a list?
ycmd/completers/java/java_completer.py, line 160 at r2 (raw file):
manifest_json = utils.ReadFile( manifest_file ) try: # TODO: use load and npt ReadFile
I have no idea what this TODO
is trying to say.
ycmd/completers/java/java_completer.py, line 280 at r2 (raw file):
def DefaultSettings( self, request_data ): return { 'bundles': self._bundles
"Bundles" as in "extensions" as in "jdt plugins"?
ycmd/tests/java/subcommands_test.py, line 1858 at r2 (raw file):
RunTest( app, { 'description': 'Running a command does what it says it does',
Haha... "DoTheThing.cmd"
ycmd/tests/java/subcommands_test.py, line 1867 at r2 (raw file):
}, 'expect': { # We dont specify the path for import organize, and jdt.ls returns shrug
But you did specify the path to Test.java
. Why am I confused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jdt.ls is unique in this regard. This "extensions" mechanism is implemented solely by jdt.ls, for jdt.ls. It's not part of the LSP; they are supplied in the initialisation settings.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @bstaletic)
ycmd/default_settings.json, line 36 at r2 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Why is this a list?
So that you can have multiple entries, like the PATH variable. We actually append our default path to this list so that we can unilaterally install extensions as part of ycmd.
ycmd/completers/java/java_completer.py, line 160 at r2 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
I have no idea what this
TODO
is trying to say.
oh yeah, it's saying to use json.load( manifest_file)
rather than utils.ReadFile( manifest_file )\n json.loads( ... )
.
It's not important (I don't remember writing it!)
ycmd/completers/java/java_completer.py, line 280 at r2 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
"Bundles" as in "extensions" as in "jdt plugins"?
'bundles' is the name of the key in the settings object we pass to jdt.ls. They themselves call them extensions. But yeah, terminology. Strictly, I guess bundles is the correct term.
I use extension path, because it should actually essentially point at VScode extensions, not to the actual bundle jars. This is to make configuration easier.
For example if you use VScode to install some VSCode extensions such as the java debugger, PDT tools for jdt, etc. then you can just point at its extension directory, and we read the package.json.
ycmd/tests/java/subcommands_test.py, line 1867 at r2 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
But you did specify the path to
Test.java
. Why am I confused?
there is an argument to the 'java.edit.organizeImports` command which is The URI of the file (or maybe files? to organise). In our actual organise imports implementation we pass the current file. IN this test, we pass nothing and the command does noting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @puremourning)
ycmd/completers/java/java_completer.py, line 160 at r2 (raw file):
Previously, puremourning (Ben Jackson) wrote…
oh yeah, it's saying to use
json.load( manifest_file)
rather thanutils.ReadFile( manifest_file )\n json.loads( ... )
.It's not important (I don't remember writing it!)
Oh, so npt
is a typo of not
!
Please remove the comment, because it's super confusing.
fb8927b
to
d39f31e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @bstaletic)
ycmd/completers/java/java_completer.py, line 160 at r2 (raw file):
Previously, bstaletic (Boris Staletic) wrote…
Oh, so
npt
is a typo ofnot
!Please remove the comment, because it's super confusing.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @bstaletic and @puremourning)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @bstaletic)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 6 files at r1, 1 of 1 files at r3.
Reviewable status: 1 of 2 LGTMs obtained
d39f31e
to
27d04d0
Compare
jdt.ls can't complete its own code without additional plugins. In particular it needs the PDE (eclipse's plugin development environment) extension. jdt.ls extensions are vscode extensions that simply include some jar files and list them in their package.json. We include support for specifying a list of paths to scan for directories containing vscode extensions in order to scoop up any jdt.ls extenions installed. A typical configuration would point at the local vscode extension directory (e.g. $HOME/.vscode/extensions). In addition the java debugger is implemented as a jdt.ls extension. This change allows the java debugger to be included in ycmd's jdt.ls instance and for Vimspector to therefore take advantage of that without starting its own instance.
LSP servers support arbitrary 'commands'. These are frustratingly client/server specific, but in some cases they just do useful stuff. One example is that the java debugger command 'vscode.java.startDebugSession' starts the debugger and returns the port on which it is listening. This is useful with vimspector. Other java commands exist in later versions of jdt.ls to sort out the build path and build the project, which are stricly useful. In future we could have a completion scheme to tab-complete the commands, but for now this exposes the raw mechanism.
27d04d0
to
2216e23
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r4, 4 of 4 files at r5.
Reviewable status: 1 of 2 LGTMs obtained (and 1 stale)
Thanks for sending a PR! |
I will add to my mental todo list to add a test which actually exercises the extension loading |
Thanks for sending a PR! |
1 similar comment
Thanks for sending a PR! |
ycm-core/ycmd#1275 Remap python GoTo* commands ycm-core/ycmd#1274 Migrate to Omnisharp-Roslyn ycm-core/ycmd#1239 Error ID in diagnostic messages ycm-core/ycmd#1267 Clangd extra conf support ycm-core/ycmd#1266 JDT update to 0.40.0 ycm-core/ycmd#1245 Generic (pluggable) LSP completer support ycm-core/ycmd#1263 Support JDT extensions ycm-core/ycmd#1261 Typescript update ycm-core/ycmd#1264 [vimspector](/puremourning/vimspector) configuration ycm-core/ycmd#1262 Multi-user installation ycm-core/ycmd#1243 Migrate to GOPLS ycm-core/ycmd#1249 Support MSVC 16 (VS2019) ycm-core/ycmd#1224 Migrate to RLS
ycm-core/ycmd#1275 Remap python GoTo* commands ycm-core/ycmd#1274 Migrate to Omnisharp-Roslyn ycm-core/ycmd#1239 Error ID in diagnostic messages ycm-core/ycmd#1267 Clangd extra conf support ycm-core/ycmd#1266 JDT update to 0.40.0 ycm-core/ycmd#1245 Generic (pluggable) LSP completer support ycm-core/ycmd#1263 Support JDT extensions ycm-core/ycmd#1261 Typescript update ycm-core/ycmd#1264 [vimspector](/puremourning/vimspector) configuration ycm-core/ycmd#1262 Multi-user installation ycm-core/ycmd#1243 Migrate to GOPLS ycm-core/ycmd#1249 Support MSVC 16 (VS2019) ycm-core/ycmd#1224 Migrate to RLS
ycm-core/ycmd#1275 Remap python GoTo* commands ycm-core/ycmd#1274 Migrate to Omnisharp-Roslyn ycm-core/ycmd#1239 Error ID in diagnostic messages ycm-core/ycmd#1267 Clangd extra conf support ycm-core/ycmd#1266 JDT update to 0.40.0 ycm-core/ycmd#1245 Generic (pluggable) LSP completer support ycm-core/ycmd#1263 Support JDT extensions ycm-core/ycmd#1261 Typescript update ycm-core/ycmd#1264 [vimspector](/puremourning/vimspector) configuration ycm-core/ycmd#1262 Multi-user installation ycm-core/ycmd#1243 Migrate to GOPLS ycm-core/ycmd#1249 Support MSVC 16 (VS2019) ycm-core/ycmd#1224 Migrate to RLS
ycm-core/ycmd#1275 Remap python GoTo* commands ycm-core/ycmd#1274 Migrate to Omnisharp-Roslyn ycm-core/ycmd#1239 Error ID in diagnostic messages ycm-core/ycmd#1267 Clangd extra conf support ycm-core/ycmd#1266 JDT update to 0.40.0 ycm-core/ycmd#1245 Generic (pluggable) LSP completer support ycm-core/ycmd#1263 Support JDT extensions ycm-core/ycmd#1261 Typescript update ycm-core/ycmd#1264 [vimspector](/puremourning/vimspector) configuration ycm-core/ycmd#1262 Multi-user installation ycm-core/ycmd#1243 Migrate to GOPLS ycm-core/ycmd#1249 Support MSVC 16 (VS2019) ycm-core/ycmd#1224 Migrate to RLS
ycm-core/ycmd#1275 Remap python GoTo* commands ycm-core/ycmd#1274 Migrate to Omnisharp-Roslyn ycm-core/ycmd#1239 Error ID in diagnostic messages ycm-core/ycmd#1267 Clangd extra conf support ycm-core/ycmd#1266 JDT update to 0.40.0 ycm-core/ycmd#1245 Generic (pluggable) LSP completer support ycm-core/ycmd#1263 Support JDT extensions ycm-core/ycmd#1261 Typescript update ycm-core/ycmd#1264 [vimspector](/puremourning/vimspector) configuration ycm-core/ycmd#1262 Multi-user installation ycm-core/ycmd#1243 Migrate to GOPLS ycm-core/ycmd#1249 Support MSVC 16 (VS2019) ycm-core/ycmd#1224 Migrate to RLS
OK, this is a little cheeky, because it's mainly for using with vimspector and in particular to make java debugging possible when you use Vimspector with ycmd : puremourning/vimspector#3 (comment)
There are other plugins too, such as one which in theory allows jdt.ls to support building its own code.
We do not include any extensions by default.
This change is