Ruin0x11 / intellij-lsp-server

Exposes IntelliJ IDEA features through the Language Server Protocol.
MIT License
318 stars 28 forks source link

Docs to additional language support #66

Open everson opened 6 years ago

everson commented 6 years ago

Hi, I would like to add Scala support for this plugin as a pull request. I would appreciate if you could give some notes of what needs to be done in order to achieve that.

Ruin0x11 commented 6 years ago

Hello. Thank you for offering to contribute.

Here are some thoughts on adding language support:

So, to summarize:

  1. Pick some method of LSP to implement, like Find Definition.
  2. Add a branching case or new subclass of DocumentCommand or ProjectCommand for Scala support.
  3. Determine how IntelliJ obtains the information needed to execute the command.
  4. Transplant that logic into the chosen Command subclass.
  5. Start the IDE in debug mode with the Run configuration from a host copy of IDEA and the LSP client. Import a Scala project to test into the debug IDEA instance, then use the LSP client to visit a Scala file tracked by that project. The client may need to be modified to start the LSP connection if a Scala file is visited (like Emacs). If the connection succeeds the debug IDEA instance should become hidden.
  6. Check the output of idea.log and standard error in your host copy of IDEA for any errors while testing.
  7. Add test cases and appropriate fixtures. (I was working on support for tests without fixtures entirely in order to remove the dependency of external files, if it works then the testing process will become simpler.)

Hopefully this should be a good amount of info. If you have any questions, please let me know.

everson commented 6 years ago

This is indeed a very good amount of info. I will report on progress after I have started. Thank you very much!

everson commented 6 years ago

So,

The good news is that preliminary support for scala already exists. Just having the scala plugin installed/setup on the project and running the command lsp-intellij-enable, many features work out of the box. This is great. I am still trying to understand the benefit of having language specific branches. I would expect that intellij would take care of that.

On other news, would you be able to tell me why I getting this green background on the whole class?

screen shot 2018-05-12 at 09 34 34

If you have not seen this, it Ok, it might be a misconfiguration on my end and I was wondering if you knew before I spend more time trying to figure it out.

Ruin0x11 commented 6 years ago

The green background indicates the thing at point is runnable with lsp-run-at-point. I guess I should add something in the README for that so it isn't confusing.

everson commented 6 years ago

Thanks for the clarification. Would you be able to point me to where in the code that is happening? I would like to be able to turn it off. I searched for it and didn't find.