Amazing tool! One question though, will there be a quick auto indent feature in the future?
Could you explain what is this quick auto-indent feature?
Sure! Sometimes when you edit code, you end up with weird indentation which ruins the organization of your code. In order to solve this Roblox has a feature known as “Format Document” in order to indent the code automatically once pressed to fix the indentation of the code.
I agree with you. I use this plugin every day and it just gets annoying without format document. What I do is copy it into studio and do the format document. Then, paste it back into VS Code.
Alright, I may work on it someday, although there already exists a full code formatter for Luau called StyLua, you could check it out.
Hi, Roblox LSP seems to have stopped working
this is the error I get everytime I open vscode
I have not changed anything since it started erroring, the only thing I did different recently is create a .code-workspace file, but it errors even if I open a folder directly.
EDIT:
I uninstalled and reinstalled Roblox LSP and it’s now working
Getting this bug over and over again
c:\Users\lemondoo\.vscode\extensions\nightrains.robloxlsp-0.15.1\server\bin\Windows\lua-language-server.exe: ...nsions/nightrains.robloxlsp-0.15.1/server/script/xml.lua:128: attempt to index a nil value (field 'attrs')
stack traceback:
...nsions/nightrains.robloxlsp-0.15.1/server/script/xml.lua:128: in function 'xml.getAttr'
...ons/nightrains.robloxlsp-0.15.1/server/script/rbxapi.lua:663: in local 'callback'
...nsions/nightrains.robloxlsp-0.15.1/server/script/xml.lua:140: in function 'xml.forAttr'
...ons/nightrains.robloxlsp-0.15.1/server/script/rbxapi.lua:659: in local 'callback'
...nsions/nightrains.robloxlsp-0.15.1/server/script/xml.lua:162: in function 'xml.forTag'
...ons/nightrains.robloxlsp-0.15.1/server/script/rbxapi.lua:658: in local 'callback'
...nsions/nightrains.robloxlsp-0.15.1/server/script/xml.lua:140: in function 'xml.forAttr'
...ons/nightrains.robloxlsp-0.15.1/server/script/rbxapi.lua:649: in method 'parseReflectionMetadata'
...ons/nightrains.robloxlsp-0.15.1/server/script/rbxapi.lua:639: in method 'loadApiJson'
...ons/nightrains.robloxlsp-0.15.1/server/script/rbxapi.lua:777: in method 'getServices'
... (skipping 8 levels)
.../nightrains.robloxlsp-0.15.1/server/script/core/init.lua:6: in main chunk
[C]: in function 'require'
...-0.15.1/server/script/method\textDocument\completion.lua:1: in main chunk
[C]: in function 'require'
...ightrains.robloxlsp-0.15.1/server/script/method/init.lua:4: in local 'init'
...ightrains.robloxlsp-0.15.1/server/script/method/init.lua:12: in main chunk
[C]: in function 'require'
...ns/nightrains.robloxlsp-0.15.1/server/script/service.lua:2: in main chunk
[C]: in function 'require'
...e\extensions\nightrains.robloxlsp-0.15.1\server\main.lua:21: in main chunk
[C]: in ?
[Info - 6:23:48 PM] Connection to server got closed. Server will restart.
It then tries to restart 5 times and then fails and then tells me the language server is not restarting - forcing me to uninstall and reinstall over and over again. Was never doing this for months and now suddenly is happening constantly.
Did a temporary fix here, but I am not sure why this was required (what changed on my end) even though I had not updated the extension for 10 months:
EDIT: After reading through more of the extension code, I think it might have to do with roblox changing their metadata files in an unsupported way (AFAIK the extension parses dumped metadata yml files such as API-Dump.json, html_md.json, ReflectionMetadata.xml)
Therefore, these parsing methods are prone to break as long as roblox keeps updating how they format metadata on their end
function xml.getAttr(xml, attr, value)
if not xml then
return
end
for _, item in pairs(xml.children) do
-- added items.attr exists check
if item.attrs and item.attrs[attr] == value then
return item
end
end
end
Yeah, is fixed in the latest versions, we don’t need to parse ReflectionMetadata anymore since it doesn’t contain documentation.
Previous versions before the patch are broken, why are you using v0.15.1?
i think lsp’s type system is a bit drunk today
This is PlayerGarbage
's type:
But look at what happens:
playerJanitor
gets tagged as any when I index it with a player type, but it becomes Janitor
when I index with it a number, even though that’s not the type I told it it would be.
Thanks for reporting, if you can make an issue in the GitHub repository it would be great.
For some reason I only seem to be able to reproduce this in one script, I’ll report it with more info if I get anything later.
Nevermind, seems like putting it on a variable is the problem.
Do I still need to disable it? The warning is not on the extension settings anymore, and it works as far as I know just fine with both diagnostics enabled, unless I’m missing something.
I like how LSP just makes empty code blocks / basically anything empty be faded, it’s useful to figure out unused code, and I wanna use selene but I don’t want to lose that, which afaik I can’t get on Selene only.
Yeah, you have to disable Roblox LSP diagnostics completely, I thought it was not important to add an option to just disable syntax errors.
You also can use Roblox LSP diagnostics only, I think they are stable enough to be a good alternative to selene.
There are two bugs with this:
-
Coloring breaks here
-
if statement snippets dont autcomplete correctly unless I move cursor down and back up
Yes, the if statement auto-completion doesn’t work well
This is not a problem with Roblox LSP but with VSCode, you have to disable editor.suggest.snippetsPreventQuickSuggestions
, this setting was added recently.
Extremely useful, although a function that silents a error would be helpfull allot!
Unsure if this is a bug that has already been reported, by specifying variable types affects the autocomplete of children. This includes not detecting children that are in the VSC explorer and not showing autocomplete for subsequently required modules.
Here’s an example:
As always, this is such a fantastic plugin. It has saved me more time than I could possibly measure. Thank you for all of the great updates and work you do on this!
Excellent extension! This should be the first extension any Roblox dev using vscode installs.
Is there (or could there be) an option to specify which .project.json
file should be used in a specific file (e.g. --@project test.project.json
)? It’s not a big deal, but my test runner script is flashing up yellow in my file explorer tab, and that’s because the LSP is using my default.project.json
and not the test.project.json
, which is specific to this file only.
Alternatively, having the LSP detect and set the correct typechecking mode for a file by identifying the mode specified on the first line would probably be fine too (I understand it’s currently a beta feature). I’m quite happy to add --!nocheck
to the first line of my test bootstrapper, since it only requires testez and loads in the project files.