Roblox LSP - Full Intellisense for Roblox and Luau!

Just a heads up, the signature for string.pack seems to be incorrect:

v1, v2, … should be “any” rather than “string”

I’m using the vscode extension. Awesome job, btw!

1 Like

I do not know what is going on but
image
This is making editing a bit of annoying and adds it into the warning counter

Click on the status bar where it says Robolx LSP, and it should refresh the workspace.

This is a known bug and I will fix it.

I think Knit type is broken. I refreshed the workspace a few times but with no luck.

As much I would like to use I don’t think my pc can handle studio and vsc at the same time :sweat_smile:

1 Like

Since 1.0.0, Many third-party libraries like Knit lost support, because Roblox LSP got fully refactored, I will re-add support for those libraries in future updates.

3 Likes

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.

1 Like

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.

1 Like

Alright, I may work on it someday, although there already exists a full code formatter for Luau called StyLua, you could check it out.

1 Like

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

1 Like

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.

1 Like

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
1 Like

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:
Code_HI1Y1FrHiK

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.

1 Like

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.

1 Like

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.

1 Like