luau-lsp icon indicating copy to clipboard operation
luau-lsp copied to clipboard

Officially support other editors

Open JohnnyMorganz opened this issue 3 years ago • 4 comments

Would be great if we could provide official support for other editors. Code can be stored in the editors/ directory.

Some editors we could support:

  • SublimeText
  • Neovim

Happy to receive contributions for any editor - the VSCode extension can be used as a reference

JohnnyMorganz avatar Jun 24 '22 19:06 JohnnyMorganz

+1 for IntelliJ, there's a few Lua plugins including this one that has the most progress on refactoring and type inference support: https://github.com/Benjamin-Dobell/IntelliJ-Luanalysis

Plugins for IntelliJ will work across almost all JetBrains IDEs, including CLion, Rider, WebStorm, RubyMine, etc

matthargett avatar Jul 25 '22 14:07 matthargett

I am trying to make luau-lsp running on my neovim for roblox development. It is kind of working, but not as good as I want. It only gives type checking, colon notation and so on. But it gives an error and does not find any Roblox type or instance.

LSP[luau] Failed to load sourcemap.json for workspace <my/workspace/path> Instance information will not be available

To get it working I followed nvim-lspconfig instructions for adding a custom language server, ''' lua if not lspconfig_configs.luau then lspconfig_configs.luau = { cmd = { "luau-lsp", "lsp" }, filetypes = { "lua" }, root_dir = lspconfig_util.root_pattern("default.project.json"), settings = {}, } end '''

nikozdev avatar Jul 26 '22 08:07 nikozdev

@nikochir A few things

  • We currently generated sourcemap.json on the client side: you need to implement this yourself in your client. The command rojo sourcemap default.project.json --output sourcemap.json needs to be run on file create/move/delete. You can run it manually or automate it.
  • You need to download the Roblox API types from https://github.com/JohnnyMorganz/luau-lsp/blob/master/scripts/globalTypes.d.lua and feed it on the command line to lsp

It should be run using

$ luau-lsp lsp --definitions=/path/to/globalTypes.d.lua

You can also download API docs and pass that too if you want them shown on hover - but it is not a requirement.

Looking at how the VSCode extension works should be a useful way to see what you need to implement on the client side: https://github.com/JohnnyMorganz/luau-lsp/blob/master/editors/code/src/extension.ts

Let me know if there is any confusions, and it would be interesting to see if we can officially support a neovim config in the repo at editors/neovim or something. If you are interested in contributing that, feel free to do so

JohnnyMorganz avatar Jul 26 '22 18:07 JohnnyMorganz

@nikochir A few things

  • We currently generated sourcemap.json on the client side: you need to implement this yourself in your client. The command rojo sourcemap default.project.json --output sourcemap.json needs to be run on file create/move/delete. You can run it manually or automate it.
  • You need to download the Roblox API types from https://github.com/JohnnyMorganz/luau-lsp/blob/master/scripts/globalTypes.d.lua and feed it on the command line to lsp

It should be run using

$ luau-lsp lsp --definitions=/path/to/globalTypes.d.lua

You can also download API docs and pass that too if you want them shown on hover - but it is not a requirement.

Looking at how the VSCode extension works should be a useful way to see what you need to implement on the client side: https://github.com/JohnnyMorganz/luau-lsp/blob/master/editors/code/src/extension.ts

Let me know if there is any confusions, and it would be interesting to see if we can officially support a neovim config in the repo at editors/neovim or something. If you are interested in contributing that, feel free to do so

TYSM! It just works, as expected =)

nikozdev avatar Aug 01 '22 17:08 nikozdev

Documentation for setting up new editors has been added at https://github.com/JohnnyMorganz/luau-lsp/blob/main/editors/README.md

If any users are interested in contributing their own client, feel free to open a PR

JohnnyMorganz avatar Apr 14 '23 11:04 JohnnyMorganz