Skip to content

Conversation

bstaletic
Copy link
Collaborator

@bstaletic bstaletic commented May 9, 2019

With this PR plugging a new server for testing is as simple as sending language_server = { $LANGUAGE: [ $SERVER_COMMANDLINE ] }.

The server that is plugged in this way can do everything the SimpleLSPCompleter can by default, but also provides GetHover subcommand to the user. It doesn't try to be smart about it and just returns { 'message': self.GetHoverResponse( request_data ) }.

The testing was done with Microsoft's sample implementation of the server which does't support the hover request.


This change is Reviewable

@bstaletic bstaletic force-pushed the null_completer_class branch 2 times, most recently from 0a49839 to 46e3e21 Compare May 10, 2019 13:05
@codecov
Copy link

codecov bot commented May 10, 2019

Codecov Report

Merging #1245 into master will increase coverage by 0.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #1245      +/-   ##
==========================================
+ Coverage   97.14%   97.15%   +0.01%     
==========================================
  Files          95       96       +1     
  Lines        7343     7376      +33     
  Branches      153      153              
==========================================
+ Hits         7133     7166      +33     
  Misses        169      169              
  Partials       41       41

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably need to update the README. We should at least to say what the 'language' parameter would be for extra conf.

I think this is neat. We could create a wiki page on the repo that says those servers known to work but are considered "unsupported" in the sense that we'll support with best-efforts only.

Thanks for doing this. It was always in the back of my mind to do something like this with LSP.

:lgtm: with minor comments.

Reviewed 9 of 9 files at r1.
Reviewable status: 1 of 2 LGTMs obtained (waiting on @bstaletic)


run_tests.py, line 322 at r1 (raw file):

  old_cwd = os.getcwd()
  os.chdir( os.path.join( DIR_OF_THIRD_PARTY, 'generic_server' ) )
  npm = FindExecutableOrDie( 'npm', 'npm is required to install TSServer.' )

We're not installing TSServer ?


run_tests.py, line 325 at r1 (raw file):

  with open( os.devnull, 'w' ) as devnull:
    subprocess.check_call( [ npm, 'install' ],
                           stdout = devnull,

what's the reason for this forced redirect ? If there are installation errors (e.g. proxy error or something), it will be tricky to debug. I'm not against the extra console output personally.


third_party/generic_server/out/server.js, line 4 at r1 (raw file):

/* --------------------------------------------------------------------------------------------
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for license information.

is this compatible with our GPL license ? Only asking because I haven't checked.

Out of interest, can we get this from npm too like we did with tern? I.e. just put it in as a dependency in package.json ?


ycmd/server_state.py, line 38 at r1 (raw file):

  if lsp_cmdline is not None:
    return generic_lsp_completer.GenericLSPCompleter(
        user_options, filetype, lsp_cmdline )

Any expectation that we might want to supply more than the command line here? e.g. should we tempt YAGNI and make it a dict like:

{
    "language_server": {
        "generic_ls": {
            "command_line": [ "thing", "here" ],
        }
    }
}

That would possibly allow us to add, say environment variables or something in future.

@bstaletic bstaletic force-pushed the null_completer_class branch from 46e3e21 to 458d0bb Compare May 20, 2019 20:35
Copy link
Collaborator Author

@bstaletic bstaletic left a 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 (and 1 stale) (waiting on @micbou and @puremourning)


run_tests.py, line 322 at r1 (raw file):

Previously, puremourning (Ben Jackson) wrote…

We're not installing TSServer ?

Done.


run_tests.py, line 325 at r1 (raw file):

Previously, puremourning (Ben Jackson) wrote…

what's the reason for this forced redirect ? If there are installation errors (e.g. proxy error or something), it will be tricky to debug. I'm not against the extra console output personally.

I thought it was annoying to see it every time you run the tests, even if you don't intend to run these tests.

Anyway, redirection dropped.


third_party/generic_server/out/server.js, line 4 at r1 (raw file):

is this compatible with our GPL license ? Only asking because I haven't checked.

MIT license is GPL-compatible as far as I know.

Out of interest, can we get this from npm too like we did with tern? I.e. just put it in as a dependency in package.json ?

I don't know because I don't know how package.json. I mean I could write a simple package.json, but what do i put in "dependencies" list? I got the example server from here:

https://github.com/microsoft/vscode-extension-samples/tree/master/lsp-sample/server


ycmd/server_state.py, line 38 at r1 (raw file):

Previously, puremourning (Ben Jackson) wrote…

Any expectation that we might want to supply more than the command line here? e.g. should we tempt YAGNI and make it a dict like:

{
    "language_server": {
        "generic_ls": {
            "command_line": [ "thing", "here" ],
        }
    }
}

That would possibly allow us to add, say environment variables or something in future.

@micbou mentioned something similar in gitter. My argument was basically YAGNI and "support on best effort basis".

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: 1 of 2 LGTMs obtained (waiting on @puremourning)


third_party/generic_server/out/server.js, line 4 at r1 (raw file):

Previously, bstaletic (Boris Staletic) wrote…

is this compatible with our GPL license ? Only asking because I haven't checked.

MIT license is GPL-compatible as far as I know.

Out of interest, can we get this from npm too like we did with tern? I.e. just put it in as a dependency in package.json ?

I don't know because I don't know how package.json. I mean I could write a simple package.json, but what do i put in "dependencies" list? I got the example server from here:

https://github.com/microsoft/vscode-extension-samples/tree/master/lsp-sample/server

I suppose we could just clone the whole thing with:

{
  "description": "Runtime area for LSP sample server",
  "dependencies": {
    "lsp-sample-server": "microsoft/vscode-extension-samples"
  }
}

But tbh this is probably fine. It allows us to fiddle with it anyway.


ycmd/server_state.py, line 38 at r1 (raw file):

Previously, bstaletic (Boris Staletic) wrote…

@micbou mentioned something similar in gitter. My argument was basically YAGNI and "support on best effort basis".

Sure. We can always do if issuance (..., dict):

Copy link
Member

@puremourning puremourning left a 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 r2.
Reviewable status: 1 of 2 LGTMs obtained

Copy link
Collaborator Author

@bstaletic bstaletic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 2 LGTMs obtained


third_party/generic_server/out/server.js, line 4 at r1 (raw file):

Previously, puremourning (Ben Jackson) wrote…

I suppose we could just clone the whole thing with:

{
  "description": "Runtime area for LSP sample server",
  "dependencies": {
    "lsp-sample-server": "microsoft/vscode-extension-samples"
  }
}

But tbh this is probably fine. It allows us to fiddle with it anyway.

The reason I put the actual source of the server in the repo was to avoid having microsoft/vscode-extension-samples a git submodule.

If you want me to, I can write the package.json and fix the paths. It would save a few MBs for the users.

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 2 LGTMs obtained


third_party/generic_server/out/server.js, line 4 at r1 (raw file):

Previously, bstaletic (Boris Staletic) wrote…

The reason I put the actual source of the server in the repo was to avoid having microsoft/vscode-extension-samples a git submodule.

If you want me to, I can write the package.json and fix the paths. It would save a few MBs for the users.

Nah I think what you have is probably the best compromise. The whole repo is kinda large, and npm cloning it wasn't quick on my machine, so having a copy is fine. It also means that we can use this code to hack test scenarios if we want to. I'm cool with it.

@bstaletic bstaletic force-pushed the null_completer_class branch from 458d0bb to c5668d3 Compare June 7, 2019 16:45
@bstaletic
Copy link
Collaborator Author

Merge conflicts solved.

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 3 of 3 files at r3.
Reviewable status: 1 of 2 LGTMs obtained

@bstaletic bstaletic force-pushed the null_completer_class branch from c5668d3 to 6a42c7e Compare June 15, 2019 13:35
Copy link
Collaborator Author

@bstaletic bstaletic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with the changes requested in gitter.

This now supports servers that target multiple filetypes.

Reviewable status: 0 of 2 LGTMs obtained (and 1 stale) (waiting on @puremourning)

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :LGTM:

Reviewed 5 of 5 files at r4.
Reviewable status: 1 of 2 LGTMs obtained

@bstaletic bstaletic force-pushed the null_completer_class branch from 6a42c7e to a6595a5 Compare June 21, 2019 12:22
Copy link
Collaborator Author

@bstaletic bstaletic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally! A green build!

Reviewable status: 0 of 2 LGTMs obtained (and 1 stale) (waiting on @puremourning)

@puremourning
Copy link
Member

Let's go.

@puremourning puremourning added the Ship It! Manual override to merge a PR by maintainer label Jun 21, 2019
@puremourning
Copy link
Member

Thanks for your patience!

@mergify mergify bot merged commit b9a206c into ycm-core:master Jun 21, 2019
@mergify
Copy link
Contributor

mergify bot commented Jun 21, 2019

Thanks for sending a PR!

bstaletic added a commit to bstaletic/YouCompleteMe that referenced this pull request Jul 3, 2019
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
bstaletic added a commit to bstaletic/YouCompleteMe that referenced this pull request Jul 4, 2019
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
bstaletic added a commit to bstaletic/YouCompleteMe that referenced this pull request Jul 4, 2019
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
bstaletic added a commit to bstaletic/YouCompleteMe that referenced this pull request Jul 4, 2019
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
bstaletic added a commit to bstaletic/YouCompleteMe that referenced this pull request Jul 5, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ship It! Manual override to merge a PR by maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants