Officially support other editors
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
+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
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 '''
@nikochir A few things
- We currently generated
sourcemap.jsonon the client side: you need to implement this yourself in your client. The commandrojo sourcemap default.project.json --output sourcemap.jsonneeds 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
@nikochir A few things
- We currently generated
sourcemap.jsonon the client side: you need to implement this yourself in your client. The commandrojo sourcemap default.project.json --output sourcemap.jsonneeds 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.luaYou 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/neovimor something. If you are interested in contributing that, feel free to do so
TYSM! It just works, as expected =)
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