LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.15k stars 290 forks source link

Support Intellij Platform #2195

Open CppCXY opened 1 year ago

CppCXY commented 1 year ago

Link: Intellij SumnekoLua

In the afternoon, after I learned that Intellij officially supports Lsp, I spent some time patching together this plugin. The plugin is not mature yet and everywhere there are errors. I might even forget about it, but I'll still leave it here for now.

Note: This plugin has not been released on the Intellij platform because it relies on features in Intellij EAP and also because Lsp support is limited. This can only be considered as a preview version.

CppCXY commented 1 year ago

An early preview version of the plugin is now available in 2023.2 beta IU version. see: https://plugins.jetbrains.com/plugin/22315-sumnekolua/versions/stable/365277

jmccallum-rbi commented 11 months ago

@CppCXY Amazing work for providing an JetBrains version os LLS! The onyl question I have is how do we make configurtions to how the plugin works? We of course have an extensive settings pain in VSCode, but I can't find out similar with Webstorm.

Unless this doesn't work with Webstorm of course.

CppCXY commented 11 months ago

Many features are not complete, jetbrain currently implements very little, so I did not write the configuration interface, if you want to configure, you can create .luarc specifically need you to see the wiki

jmccallum-rbi commented 11 months ago

Many features are not complete, jetbrain currently implements very little, so I did not write the configuration interface, if you want to configure, you can create .luarc specifically need you to see the wiki

Do you happen to have an example .luarc.json that you can provide to start me off at all?

carsakiller commented 11 months ago

@enlistedmango, an example and explanation of the .luarc configuration file can be found in the wiki.

derek-miller commented 11 months ago

I have the plugin installed in the latest version of IntelliJ, however I do not get any autocomplete functionality. I have the lua-language-server installed and configured using a .luarc.json file in the project workspace. Any ideas?

CppCXY commented 11 months ago

I have the plugin installed in the latest version of IntelliJ, however I do not get any autocomplete functionality. I have the lua-language-server installed and configured using a .luarc.json file in the project workspace. Any ideas?

What operating system? Perhaps the executable does not have execute permissions

derek-miller commented 11 months ago

macOS. I can run the lua-language-server binary just fine from the command line. It was installed with brew. I thought maybe I had to configure something more on the plugin side but I don’t see anything in the settings

CppCXY commented 11 months ago

macOS. I can run the lua-language-server binary just fine from the command line. It was installed with brew. I thought maybe I had to configure something more on the plugin side but I don’t see anything in the settings

The plugin on Intellij uses the built-in Luals, but the plugin installation package of Intellij is zip, which will lose the executable permissions on Linux and Mac, maybe you need to give exe executable permissions before execution, you can look in the plugin to see if there is permission in the lua-language-server file

derek-miller commented 11 months ago

Looks like you were right:

$ ll /Users/<user>/Library/Application\ Support/JetBrains/IntelliJIdea2023.2/plugins/Sumneko-Lua/server/darwin-arm64/bin/lua-language-server 
-rw-r--r--  1 <user>  staff   1.1M Aug 22 23:35 /Users/<user>/Library/Application Support/JetBrains/IntelliJIdea2023.2/plugins/Sumneko-Lua/server/darwin-arm64/bin/lua-language-server
derek-miller commented 11 months ago

I added executable permissions but it still doesn't appear to be working. Is there any way to see if its running or debug whats broken?

CppCXY commented 11 months ago

I added executable permissions but it still doesn't appear to be working. Is there any way to see if its running or debug whats broken?

you can just clone this project and debug by youself, I don't have a Mac and I don't know what might happen

derek-miller commented 11 months ago

So I got the project up and running and it seems to work, but still does not in my regular env. Are there any plugin logs I can look at?

CppCXY commented 11 months ago

So I got the project up and running and it seems to work, but still does not in my regular env. Are there any plugin logs I can look at?

first you can install your build plugin and it is in build/distribution, and the runtime log is in the log directory of the lua-language-server like "server/darwin-x64/log"

derek-miller commented 11 months ago

I installed the dev version in IntelliJ and it is not working. I looked for the logs and there are none.

derek-miller commented 11 months ago

Oh, and I diff'ed file permissions between the working and non-working plugin folders and they are identical

CppCXY commented 11 months ago

Oh, and I diff'ed file permissions between the working and non-working plugin folders and they are identical

Afterward, I can specify the location of lua-language-server. I'm not sure if it's possible to request permissions during runtime in IDEA. If you are still unable to work properly, you can go to my project and raise an issue for further discussion.