Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 527206

Summary: Merge LSP support into master
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: ClientAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: remy.suen, Silenio_Quarti
Version: 16.0   
Target Milestone: 18.0   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 525573, 528093    
Bug Blocks:    

Description Michael Rennie CLA 2017-11-13 10:45:12 EST
So that developers can test / play with LSP support in Orion, we need to merge the core parts needed to run / use a language server from the java-lsp branch into master.

This includes (but not limited to):
1. the IPC classes in the client and the server
2. an example plugin (or maybe use the Java plugin as the example, commented out for now)
3. The language server registry
4. the language server editor hooks
Comment 1 Michael Rennie CLA 2017-11-14 09:05:04 EST
I have merged the client-side classes into master from the branch:

https://github.com/eclipse/orion.client/commit/1668a6c109a8d38f273111b8abc2cd135fb92eab

they are not hooked up to the editor yet though - this is just a move / refactor.
Comment 2 Michael Rennie CLA 2017-11-22 09:59:49 EST
The editor.js changes:

https://github.com/eclipse/orion.client/commit/136451838b0eb375e097baea3131aa3e6ca228d7
Comment 4 Michael Rennie CLA 2017-11-23 10:05:47 EST
Move event range compatibility to textModel and provide it for onChanged* events as well:

https://github.com/eclipse/orion.client/commit/b47c70b228580eb4c9403c159160f763c40c6c62
Comment 5 Silenio Quarti CLA 2017-11-24 17:47:50 EST
(In reply to Michael Rennie from comment #3)
> textView changes:
> 
> https://github.com/eclipse/orion.client/commit/
> 32764494a47a3282dca6ba8a0dfd1a62be9467e6

This commit seems to be causing selection problems in the editor. Try drag selecting in the middle of a line and move the mouse down.  Only the bottom of the selection should change, but the top flickers back and forward in the line.
Comment 6 Silenio Quarti CLA 2017-11-24 17:54:22 EST
Pushed this to fix the problem above

https://github.com/eclipse/orion.client/commit/b2e56157e3ced7b371651090e7261491e677a271
Comment 7 Michael Rennie CLA 2017-11-30 13:04:59 EST
The LSP / LS build files for Orion (scripts and Dockerfile):

https://github.com/eclipse/orion.client/commit/26745ee4074fe2c1bb9a24b1a6a1814ccd3c175d
Comment 8 Remy Suen CLA 2018-01-10 20:47:58 EST
inputManager.js changes introduced by bug 518735:

https://github.com/eclipse/orion.client/commit/62e60e09849e5ce4645587be4b1022b5f190676c
Comment 9 Remy Suen CLA 2018-01-11 06:23:51 EST
problems.js changes:

https://github.com/eclipse/orion.client/commit/7571bc0c7f61982b9805951a8fc945be08ca2f6e

This extra parameter is used by languageServer.js although nothing's going to happen right now as it's not fully setup yet.

https://github.com/eclipse/orion.client/blob/e176d23591774585de3220f957f10faacdfcf70f/bundles/org.eclipse.orion.client.core/web/lsp/languageServer.js#L70
Comment 13 Remy Suen CLA 2018-01-13 02:39:30 EST
markOccurrences.js changes:

https://github.com/eclipse/orion.client/commit/169c7f1b5b202cc329e069ba41b0a16840494365
Comment 14 Remy Suen CLA 2018-01-13 03:32:01 EST
There are some changes to how offsets and the text is adjusted in contentAssist.js. This is what the file looks like in the java-lsp branch:

https://github.com/eclipse/orion.client/blob/a711742cfedc45710437c2c9e69e8676fae87fcc/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js#L194-L203

If you search for the string "additionalEdits" in the master branch, you will actually find nothing outside of references in org.eclipse.client.core/web/lsp/utils.js which implies that the existence and use of this additionalEdits array existed before LSP but not in Orion internally (or at least not anymore). When you dig further, you will find that this code was originally added for bug 439272 by someone who was extending Orion.

https://github.com/eclipse/orion.client/commit/3b300cdb6e4dea266cd0463214855580ca866b39

The original applies the content in order and the LSP way applies the content backwards (to preserve the offsets). Presumably the original implementation used offsets that were already adjusted (I guess?). In LSP, the offsets are not adjusted. Please refer to the discussion on GitHub and the specification.

https://github.com/Microsoft/language-server-protocol/issues/104

https://github.com/Microsoft/language-server-protocol/commit/e1e59508d52e7451ed8cf94bee99e5b5cbdfd99c

Consider the following where the string is "12345" and you want "1x2y345". You would need to insert x at index 1 and y at index 3 (instead of 2 because the content will have shifted).

insert x at index 1
insert y at index 3

Original code:
1x2345
1x2y345

LSP code:
123y45
1x23y45

So as we can see, if we apply the changes to contentAssist.js as-is from the java-lsp branch then we will break clients who are using this additionalEdits property.
Comment 15 Remy Suen CLA 2018-01-13 03:48:22 EST
contentAssist.js changes minus the diff described in comment 14:

https://github.com/eclipse/orion.client/commit/15c2706cf0c389b236736febd407357e5920b6e1
Comment 16 Michael Rennie CLA 2018-03-19 10:46:21 EDT
The support is as "merged" as it is going to get right now. I will open up separate issues as needed to track more additions.