nightrainsrbx / robloxlsp Goto Github PK
View Code? Open in Web Editor NEWRoblox Luau Language Server based on Lua by sumneko.
Home Page: https://devforum.roblox.com/t/roblox-lsp-full-intellisense-for-roblox-and-luau/717745
License: MIT License
Roblox Luau Language Server based on Lua by sumneko.
Home Page: https://devforum.roblox.com/t/roblox-lsp-full-intellisense-for-roblox-and-luau/717745
License: MIT License
Function type issues (see code below for examples):
pcall
's 2nd argument should always be any
(this is shown correctly if you hover over pcall, but not when you go to use the variable)warn
acts like print
, but here it is expected to have a string argument (and so warns if you try to do warn(workspace)
, even though this works fine in Roblox)local function f(arg) return arg.example end
local success, result = pcall(f, workspace)
if not success then warn(result) end
This code has these issues:
arg.example
is sometimes considered boolean and there is no "undefined member" warning generated for it (despite arg
being assumed to be workspace
). (I'm unsure how this happened; by the time I was nearly finished writing this issue I could no longer recreate this problem.)result
is considered boolean when arg.example is considered boolean (but the whole point of pcall is that it may return an error message/object, so result
should always be of type any
)f
returns and then delete the return
, the fact that it isn't returning anything isn't updated:(I once didn't have to delete the return
but just changed it to arg.example
or arg["example"]
(not sure which) and it still thought f
was returning a function)
local function f(arg) return arg["example"] end
local success, result = pcall(f, workspace)
if not success then warn(result) end
arg["example"]
is the same as arg.example
, but no warning is generatedresult
is considered any
here, but the warning on line 3 is "Argument of type `string` expected, got `function`." If you hover over f
, it supposedly returns a function.Also, undefined members of game/workspace/etc are currently considered of type any
, but the only thing they could be (if you're willing to assume that you have the complete API) is Instance
(though I am unsure if this should be changed).
I am using Visual Studio Code with RobloxLsp being the only enabled Lua-related extension.
[Edit: I have no idea why, but suddenly the extension has given up complaining about workspace.example
, even though it's still warning for game.example
- and I can replace example
with anything and it persists.]
When you use RobloxLsp on large scripts like 5k lines, It starts to get very slow.
Is it possible to use this in the browser (webpack) with in-memory files?
Being able to view this information would help immeasurably
Luau TypeChecking
--A module for storing my own types
export type Array<T> = {[number]: T} --Thinks Array is any
export type ExtraData = {Tags : Array<string>?} --Thinks ExtraData is any
local types = {}
return types
--A place I want to use the types
local Types = require(script.Parent.Types)
local data :Types.ExtraData --doesn't think ExtraData is a type
data = 4 --thinks data is "any"
Typed Lua has a new syntax for arrays in the form {T}
where T is a type. It's not supported by the LSP, but it should be.
Ok so I'm trying to get Roblox LSP to work but it isn't for some reason. I have the latest VS Code plugin but every time I click the extension in Roblox studio I get this error.
Here is my output:
[2021-08-19 10:25:31.215] [exthost] [info] extension host started [2021-08-19 10:25:31.240] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication {"startup":false,"extensionId":{"value":"vscode.microsoft-authentication","_lower":"vscode.microsoft-authentication"},"activationEvent":"onAuthenticationRequest:microsoft"} [2021-08-19 10:25:31.240] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/microsoft-authentication/dist/extension.js [2021-08-19 10:25:31.248] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"extensionId":{"value":"vscode.debug-auto-launch","_lower":"vscode.debug-auto-launch"},"activationEvent":"*"} [2021-08-19 10:25:31.248] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/debug-auto-launch/dist/extension [2021-08-19 10:25:31.250] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":"*"} [2021-08-19 10:25:31.250] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/main [2021-08-19 10:25:31.263] [exthost] [info] ExtensionService#_doActivateExtension CoenraadS.bracket-pair-colorizer {"startup":true,"extensionId":{"value":"CoenraadS.bracket-pair-colorizer","_lower":"coenraads.bracket-pair-colorizer"},"activationEvent":"*"} [2021-08-19 10:25:31.264] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/dorson_home/.vscode/extensions/coenraads.bracket-pair-colorizer-1.0.61/out/src/extension [2021-08-19 10:25:31.276] [exthost] [info] ExtensionService#_doActivateExtension PKief.material-icon-theme {"startup":true,"extensionId":{"value":"PKief.material-icon-theme","_lower":"pkief.material-icon-theme"},"activationEvent":"*"} [2021-08-19 10:25:31.276] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/dorson_home/.vscode/extensions/pkief.material-icon-theme-4.9.0/dist/extension [2021-08-19 10:25:31.319] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.js-debug {"startup":false,"extensionId":{"value":"ms-vscode.js-debug","_lower":"ms-vscode.js-debug"},"activationEvent":"onCommand:extension.js-debug.clearAutoAttachVariables"} [2021-08-19 10:25:31.319] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js [2021-08-19 10:25:31.437] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication {"startup":false,"extensionId":{"value":"vscode.github-authentication","_lower":"vscode.github-authentication"},"activationEvent":"onAuthenticationRequest:github"} [2021-08-19 10:25:31.437] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/github-authentication/dist/extension.js [2021-08-19 10:25:31.461] [exthost] [info] ExtensionService#_doActivateExtension vscode.github {"startup":true,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":"*"} [2021-08-19 10:25:31.461] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/github/dist/extension.js [2021-08-19 10:25:31.471] [exthost] [info] eager extensions activated [2021-08-19 10:25:31.475] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":false,"extensionId":{"value":"vscode.emmet","_lower":"vscode.emmet"},"activationEvent":"onStartupFinished"} [2021-08-19 10:25:31.476] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/emmet/dist/node/emmetNodeMain [2021-08-19 10:25:31.481] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":false,"extensionId":{"value":"vscode.merge-conflict","_lower":"vscode.merge-conflict"},"activationEvent":"onStartupFinished"} [2021-08-19 10:25:31.481] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/merge-conflict/dist/mergeConflictMain [2021-08-19 10:25:31.484] [exthost] [info] ExtensionService#_doActivateExtension vscode.testing-editor-contributions {"startup":false,"extensionId":{"value":"vscode.testing-editor-contributions","_lower":"vscode.testing-editor-contributions"},"activationEvent":"onStartupFinished"} [2021-08-19 10:25:31.484] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/testing-editor-contributions/dist/extension.js [2021-08-19 10:26:02.524] [exthost] [info] extension host terminating: received terminate message from renderer [2021-08-19 10:26:03.529] [exthost] [info] exiting with code 0 [2021-08-19 10:26:05.914] [exthost] [info] extension host started [2021-08-19 10:26:05.944] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication {"startup":false,"extensionId":{"value":"vscode.microsoft-authentication","_lower":"vscode.microsoft-authentication"},"activationEvent":"onAuthenticationRequest:microsoft"} [2021-08-19 10:26:05.945] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/microsoft-authentication/dist/extension.js [2021-08-19 10:26:05.952] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"extensionId":{"value":"vscode.debug-auto-launch","_lower":"vscode.debug-auto-launch"},"activationEvent":"*"} [2021-08-19 10:26:05.952] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/debug-auto-launch/dist/extension [2021-08-19 10:26:05.955] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":"*"} [2021-08-19 10:26:05.955] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/main [2021-08-19 10:26:05.969] [exthost] [info] ExtensionService#_doActivateExtension CoenraadS.bracket-pair-colorizer {"startup":true,"extensionId":{"value":"CoenraadS.bracket-pair-colorizer","_lower":"coenraads.bracket-pair-colorizer"},"activationEvent":"*"} [2021-08-19 10:26:05.969] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/dorson_home/.vscode/extensions/coenraads.bracket-pair-colorizer-1.0.61/out/src/extension [2021-08-19 10:26:05.984] [exthost] [info] ExtensionService#_doActivateExtension PKief.material-icon-theme {"startup":true,"extensionId":{"value":"PKief.material-icon-theme","_lower":"pkief.material-icon-theme"},"activationEvent":"*"} [2021-08-19 10:26:05.984] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/dorson_home/.vscode/extensions/pkief.material-icon-theme-4.9.0/dist/extension [2021-08-19 10:26:06.714] [exthost] [info] ExtensionService#_doActivateExtension vscode.github {"startup":true,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":"*"} [2021-08-19 10:26:06.714] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/github/dist/extension.js [2021-08-19 10:26:06.735] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.js-debug {"startup":false,"extensionId":{"value":"ms-vscode.js-debug","_lower":"ms-vscode.js-debug"},"activationEvent":"onCommand:extension.js-debug.clearAutoAttachVariables"} [2021-08-19 10:26:06.735] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js [2021-08-19 10:26:06.811] [exthost] [info] ExtensionService#_doActivateExtension evaera.vscode-rojo {"startup":true,"extensionId":{"value":"evaera.vscode-rojo","_lower":"evaera.vscode-rojo"},"activationEvent":"workspaceContains:*.project.json"} [2021-08-19 10:26:06.811] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/dorson_home/.vscode/extensions/evaera.vscode-rojo-1.12.7/out/extension [2021-08-19 10:26:07.182] [exthost] [info] eager extensions activated [2021-08-19 10:26:07.275] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication {"startup":false,"extensionId":{"value":"vscode.github-authentication","_lower":"vscode.github-authentication"},"activationEvent":"onAuthenticationRequest:github"} [2021-08-19 10:26:07.276] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/github-authentication/dist/extension.js [2021-08-19 10:26:07.287] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":false,"extensionId":{"value":"vscode.emmet","_lower":"vscode.emmet"},"activationEvent":"onStartupFinished"} [2021-08-19 10:26:07.288] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/emmet/dist/node/emmetNodeMain [2021-08-19 10:26:07.293] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":false,"extensionId":{"value":"vscode.merge-conflict","_lower":"vscode.merge-conflict"},"activationEvent":"onStartupFinished"} [2021-08-19 10:26:07.293] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/merge-conflict/dist/mergeConflictMain [2021-08-19 10:26:07.299] [exthost] [info] ExtensionService#_doActivateExtension vscode.testing-editor-contributions {"startup":false,"extensionId":{"value":"vscode.testing-editor-contributions","_lower":"vscode.testing-editor-contributions"},"activationEvent":"onStartupFinished"} [2021-08-19 10:26:07.299] [exthost] [info] ExtensionService#loadCommonJSModule file:///private/var/folders/f9/8k0_nsfj0fg2vz8gq9kw0xx80000gn/T/AppTranslocation/2F126909-E54A-47C9-A3E1-79BFD830691A/d/Visual Studio Code.app/Contents/Resources/app/extensions/testing-editor-contributions/dist/extension.js [2021-08-19 10:27:43.025] [exthost] [info] ExtensionService#_doActivateExtension Kampfkarren.selene-vscode {"startup":false,"extensionId":{"value":"Kampfkarren.selene-vscode","_lower":"kampfkarren.selene-vscode"},"activationEvent":"onLanguage:lua"} [2021-08-19 10:27:43.025] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/dorson_home/.vscode/extensions/kampfkarren.selene-vscode-1.0.3/out/extension.js [2021-08-19 10:27:43.439] [exthost] [info] ExtensionService#_doActivateExtension Nightrains.robloxlsp {"startup":false,"extensionId":{"value":"Nightrains.robloxlsp","_lower":"nightrains.robloxlsp"},"activationEvent":"onLanguage:lua"} [2021-08-19 10:27:43.439] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/dorson_home/.vscode/extensions/nightrains.robloxlsp-0.15.11/client/out/extension
I don't get any error syntax highlighting! The "Lua By sumneko" plugin is uninstalled, and when I switch to that I get error syntax highlighting easily. This is an issue I have been facing suddenly since the past month or so.
Here is a picture -
As you see, I just randomly typed and it shows no errors for that at all
PS: I have even tried changing to an older version, so maybe a setting is causing it.(All my settings are defaults)
Tried restarting both VSCode, Studio and Rojo and nothing helped.
Plugin errors on every single lua keyword. It's up to date. I don't have the other Lua plugin installed.
Error:
attempt to index a nil value
stack traceback:
...rver/script/method\textDocument\semanticTokens\range.lua:36: in upvalue 'resolveTokens'
...rver/script/method\textDocument\semanticTokens\range.lua:119: in function <...rver/script/method\textDocument\semanticTokens\range.lua:101>
[C]: in function 'xpcall'
...ions/nightrains.robloxlsp-0.15.8/server/script/timer.lua:45: in upvalue 'mWakeup'
...ions/nightrains.robloxlsp-0.15.8/server/script/timer.lua:86: in upvalue 'onTick'
...ions/nightrains.robloxlsp-0.15.8/server/script/timer.lua:125: in function 'timer'
[C]: in function 'xpcall'
...ns/nightrains.robloxlsp-0.15.8/server/script/service.lua:1094: in method 'listen'
...e\extensions\nightrains.robloxlsp-0.15.8\server\main.lua:24: in main chunk
[C]: in ?
The syntax highlighting used for the vscode extension is not very good. It highlights local
as constant.language
and does not provide special highlighting for Roblox built-in functions. It also highlights _
as a constant.
Right now it throws a warning if you try to do Instance:IsA("Status") and won't typecheck properly if you do local Status : Status etc.
https://developer.roblox.com/en-us/api-reference/class/Status
Minimum reproduction code that I could find:
local function check(list)
for _, v in ipairs(list) do
return 3
end
return list
end
local function callCheck(list)
check(list)
end
It complains that ipairs(list)
is wrong; it thinks that list
is a number (despite showing that it's a table when you hover over it). If you change return 3
to return false
, it then thinks it's a boolean.
This feature only works with CRLF line endings, but it should work with LF
"Lua.completion.endAutocompletion": true
It seems very common (w/ Nevermore, Knit, and a lot of custom solutions I've seen) for people to use custom module loaders that recursively search for a module given a string.
This is how you'd get intellisense for a module w/ Nevermore:
local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))
---@module src.modules.Utility.Maid
local Maid = require("Maid")
-- Now intellisense finds :GiveTask() / :Destroy() etc...
However, it can get cumbersome to add a statement for each module. This could be fixed by searching for Nevermore
, or checking for using require with a string, etc. However this isn't versatile.
A good solution could be a tag like this, which only applies to functions that are passed strings.
---@moduleloader <list of relative source directories, searched recursively>
local loader = function(inString) end
---@moduleloader src.modules src.more_modules
local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))
local Maid = require("Maid")
-- Now intellisense finds :GiveTask() / :Destroy() etc...
---@moduleloader src.modules src.more_modules
local loader = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))
local Maid = loader("Maid")
This could cause some weird conflicts. For example, several modules with the same name. To fix this, you could allow ---@module
to override any assumptions made by ---@moduleloader
.
This seems like a pretty good compromise between ease of use and control?
These will cause the display information about a function to completely fail, rendering all parameter types up to the multi-type parameter as any
(parameters after the multi-type parameter render normally).
To reproduce:
Create a new function with a singular parameter type and some documentation.
--- Hello!
function Hello(message: string)
end
The expected display information comes up as intended:
Now alter message
to be a multi-type, such as string | number
:
--- Hello!
function Hello(message: string | number)
end
And now it fails to parse properly, relaying this result. It also omits documentation from under the function:
Nullable parameters in shorthand type?
do not show properly.
To reproduce:
Create a new function with a singular parameter type and docs like above.
--- Hello!
function Hello(message: string)
end
Now, alter the string to be nullable (change it to string?
).
The result of hovering over the function will still show the type as string
rather than the expected string?
I've recently installed the plugin (version v0.11.5), and It was working at first up until I've accidentally installed a Lua plugin from "keyring". After that, the autocomplete stopped working and I've tried reinstalling, restarting my pc, reloading my editor and nothing seems to be working. Please help as soon as possible. And I've also tried looking in settings.
I'm creating a script that uses a global that is not normally in roblox, When I add the global to the Settings page I expected it to stop warning me but it still warns me (I believe that it used to stop warning but does not anymore).
I've tried putting the global in both workspace and user settings but they both appear to get ignored.
hey, not sure who here is aware of this already, but the maintainer of the lua language server plans on (or who knows, already has; haven't seen the vscode extension) adding native support for third party APIs in that server. I won't say too much, you can check out a couple of these links.
surely some of you here have more experience on this than I. the structure is certainly a major difference (emmylua annotations I think); does anybody believe it would be possible to port the data from here over?
edit: it's not exactly related to this project but the data here may well be the best place to write from. not to mention it could even make this server obsolete if done well enough (although I'm not sure if it can, that's what this issue is about).
Make a color picker UI like Roblox's. You can click a little icon next to the color icon and open a color picker.
The language server continues to run in the background even after VS Code is closed or reloaded on Linux (I'm using Ubuntu 20.04.2.0 LTS and Arch Linux).
This effect doesn't seems to happen when using the original LSP extension.
Steps to reproduce:
Developer: Reload Window
command or just closing the app.Referencing the undefined member
warning in the devforum.roblox.com post:
When writing the same name twice or more across all the scripts, it will automatically ignored.
There are two problem cases (that I believe are reasonably common):
Suggestions:
MyInstance
is not a defined member of ServerScriptService
in datamodel.json")In Roblox, globals defined in a script are not shared between files.
If you put this into a file:
function type() end
function typeof() end
...all files in the project will use these ones.
If you then delete those custom functions, all other files will underline any references to type/typeof, complaining that they are undefined globals. While the custom functions are defined, the colour of type/typeof are changed to reflect that they are non-standard global variables; this does not revert when the functions are removed. If I open up a file I haven't looked at yet, sometimes references to type/typeof will have the correct colour, but in all cases they will still be underlined and have the wrong signature if you hover over them.
As an example, something like type foo = number
will error. This is valid in Luau, so it should be valid when using the server.
Seems to be working properly now
Hello,
The extension was working fine until one day it stopped autocompleting and it will show wrong problems
I noticed the Lua Language Server is no longer a process in task manager so it might be that.
I disabled every other extension that could be conflicting and only left these:
The Lua extension by sumneko works fine though.
I also made sure I have enough RAM, reinstalled the extension and restarted VS Code.
Here are other details that may be helpful:
Version: 1.59.1 (system setup)
Commit: 3866c3553be8b268c8a7f8c0482c0c0177aa8bfa
Date: 2021-08-19T11:56:46.957Z
Electron: 13.1.7
Chrome: 91.0.4472.124
Node.js: 14.16.0
V8: 9.1.269.36-electron.0
OS: Windows_NT x64 10.0.19042
It would be really handy if Roblox LSP had the option available to automatically place parenthesis after function references.
An example of this would be selecting print
from a suggestion drop-down and instead of auto-filling just print
it would auto-fill print()
and place your cursor in between the parentheses to define arguments.
( Roblox does this in their own built-in editor reference here: https://gyazo.com/57fa00675ce6f9df80a926570d07a5ec )
Hello!
So i wanted to use it so i downloaded Selen and Lua language server and Roblox Lsp in vscode.
But nothing happens, it just doesn't do anything.
Luau has an operator (::
) that applies type assertion, similar to the as
operator in TypeScript.
Example:
local object: Instance = workspace:FindFirstChild("Part")
if object and object:IsA("BasePart") then
local part: BasePart = (object :: BasePart)
print(part.Size)
end
Currently this syntax is marked as invalid by the LSP, but it should at least be easier to integrate than custom type-declarations are :)
It's running on the right port, my firewall isn't blocking it, and i'm on a mac. Output in roblox is:
13:39:29.814 [Roblox LSP] Failed to connect: HttpError: ConnectFail - Studio 13:39:29.814 Make sure the VSCode Extension is running and hosting: http://127.0.0.1:27843 - Studio
Occasionally while I'm writing code, a textDocument/completion
request fails. Full unabridged output is below.
All of the times it's happened, it's been while I was writing out the variable root
which is an Instance. I have a few other variables that also start with root
, which may be the uh, 'root' cause.
Output:
[Error - 4:14:30 PM] Request textDocument/completion failed.
Message: {
context = {
triggerCharacter = "o",
triggerKind = 2,
},
position = {
character = 68,
line = 194,
},
textDocument = {
uri = "file:///c%3A/Users/Dekkonot/Documents/ROBLOX/Github/rbx-instance-serializer/src/Serializer/Verbose/init.lua",
},
}
...s.robloxlsp-0.14.4/server/script/core\hover\function.lua:4: attempt to index a nil value
stack traceback:
...s.robloxlsp-0.14.4/server/script/core\hover\function.lua:4: in upvalue 'getTypeWithText'
...s.robloxlsp-0.14.4/server/script/core\hover\function.lua:33: in upvalue 'buildValueArgs'
...s.robloxlsp-0.14.4/server/script/core\hover\function.lua:241: in function 'core.hover.function'
...rains.robloxlsp-0.14.4/server/script/core\completion.lua:79: in upvalue 'getDucumentation'
...rains.robloxlsp-0.14.4/server/script/core\completion.lua:241: in upvalue 'getValueData'
...rains.robloxlsp-0.14.4/server/script/core\completion.lua:291: in local 'callback'
...ions/nightrains.robloxlsp-0.14.4/server/script/vm\vm.lua:1460: in function 'vm.manager.eachSource'
...rains.robloxlsp-0.14.4/server/script/core\completion.lua:281: in upvalue 'searchLocals'
...rains.robloxlsp-0.14.4/server/script/core\completion.lua:558: in upvalue 'searchAsGlobal'
...rains.robloxlsp-0.14.4/server/script/core\completion.lua:699: in upvalue 'searchSource'
...rains.robloxlsp-0.14.4/server/script/core\completion.lua:1316: in function 'core.completion'
...-0.14.4/server/script/method\textDocument\completion.lua:69: in upvalue 'fastCompletion'
...-0.14.4/server/script/method\textDocument\completion.lua:137: in function 'method.textDocument.completion'
[C]: in function 'xpcall'
...ns/nightrains.robloxlsp-0.14.4/server/script/service.lua:62: in method '_callMethod'
...ns/nightrains.robloxlsp-0.14.4/server/script/service.lua:106: in method '_doProto'
...ns/nightrains.robloxlsp-0.14.4/server/script/service.lua:803: in method '_loadProto'
...ns/nightrains.robloxlsp-0.14.4/server/script/service.lua:778: in method '_doCompileTask'
...ns/nightrains.robloxlsp-0.14.4/server/script/service.lua:1065: in method 'onTick'
...ns/nightrains.robloxlsp-0.14.4/server/script/service.lua:1087: in method 'listen'
...e\extensions\nightrains.robloxlsp-0.14.4\server\main.lua:24: in main chunk
[C]: in ?
Code: -32603
So for some reason on my script i can not reduce do, if, while
, etc.
It doesn't happens with normal visual studio code.
Really only need to add support for the two functions in task
being task.synchronize
and task.desynchronize
, as well as RBXScriptSignal::ConnectParallel
.
When I write a script it keeps saying that its a module script and I need to make a module, is there a way to fix that?
function example(x: () -> (nil)?)
end
The above works.
function example(x: () -> ()?)
end
This gives the following errors:
Missed symbol )
.
Unexpected symbol ?)
.
The function getfenv supports either a function or a number as the first argument, but if I use a number RobloxLsp will give the following error "Argument of type function
expected, got number
".
This task currently does nothing but produce an error, which can be confusing for anyone forking / cloning the repo. As I see it, there's two options:
.vscode/launch.json
that defines npm: watch
as a pre-launch task. ("preLaunchTask": "npm: watch"
). While this removes the immediate issue if the user tries to build, they will get an error."preLaunchTask": "npm: watch"
and also remove the task in .vscode/tasks.json
, so that building will not produce any errors as well.Currently having an issue when I declare a variable's type to RBXScriptSignal where LSP will break.
The following code is an example of what would cause the issue:
local ExampleEvent: RBXScriptSignal = BindableEvent.Event
Once the type is set to RBXScriptSignal, LSP will start to throw errors on every key pressed until the type is changed.
The error is as follows:
stack traceback:
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:406: in function 'vm.manager.call'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:365: in function 'vm.manager.callLibrary'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:382: in function 'vm.manager.call'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:606: in function 'vm.manager.getSimple'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1176: in function 'vm.manager.doAction'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1201: in function 'vm.manager.doActions'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:142: in function 'vm.manager.runFunction'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1221: in function 'vm.manager.callLeftFuncions'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1413: in function <...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1400>
[C]: in function 'xpcall'
... (skipping 1 levels)
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:447: in method 'loadVM'
...-0.11.0/server/script/method\textDocument\completion.lua:57: in upvalue 'fastCompletion'
...-0.11.0/server/script/method\textDocument\completion.lua:133: in function 'method.textDocument.completion'
[C]: in function 'xpcall'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:62: in method '_callMethod'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:106: in method '_doProto'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:803: in method '_loadProto'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:1064: in method 'onTick'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:1087: in method 'listen'
...e\extensions\nightrains.robloxlsp-0.11.0\server\main.lua:24: in main chunk
[C]: in ?
stack traceback:
[C]: in function 'error'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:601: in method 'compileVM'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:447: in method 'loadVM'
...-0.11.0/server/script/method\textDocument\completion.lua:57: in upvalue 'fastCompletion'
...-0.11.0/server/script/method\textDocument\completion.lua:133: in function 'method.textDocument.completion'
[C]: in function 'xpcall'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:62: in method '_callMethod'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:106: in method '_doProto'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:803: in method '_loadProto'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:1064: in method 'onTick'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:1087: in method 'listen'
...e\extensions\nightrains.robloxlsp-0.11.0\server\main.lua:24: in main chunk
[C]: in ?
Code: -32603
...ightrains.robloxlsp-0.11.0/server/script/vm\rbxtypes.lua:204: attempt to index a nil value (local 'lib')
stack traceback:
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:406: in function 'vm.manager.call'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:365: in function 'vm.manager.callLibrary'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:382: in function 'vm.manager.call'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:606: in function 'vm.manager.getSimple'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1176: in function 'vm.manager.doAction'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1201: in function 'vm.manager.doActions'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:142: in function 'vm.manager.runFunction'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1221: in function 'vm.manager.callLeftFuncions'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1413: in function <...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1400>
[C]: in function 'xpcall'
... (skipping 1 levels)
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:447: in method 'loadVM'
...-0.11.0/server/script/method\textDocument\completion.lua:57: in upvalue 'fastCompletion'
...-0.11.0/server/script/method\textDocument\completion.lua:133: in function 'method.textDocument.completion'
[C]: in function 'xpcall'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:62: in method '_callMethod'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:106: in method '_doProto'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:803: in method '_loadProto'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:1064: in method 'onTick'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:1087: in method 'listen'
...e\extensions\nightrains.robloxlsp-0.11.0\server\main.lua:24: in main chunk
[C]: in ?
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:601: ...ightrains.robloxlsp-0.11.0/server/script/vm\rbxtypes.lua:204: attempt to index a nil value (local 'lib')
stack traceback:
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:406: in function 'vm.manager.call'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:365: in function 'vm.manager.callLibrary'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:382: in function 'vm.manager.call'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:606: in function 'vm.manager.getSimple'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1176: in function 'vm.manager.doAction'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1201: in function 'vm.manager.doActions'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:142: in function 'vm.manager.runFunction'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1221: in function 'vm.manager.callLeftFuncions'
...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1413: in function <...ions/nightrains.robloxlsp-0.11.0/server/script/vm\vm.lua:1400>
[C]: in function 'xpcall'
... (skipping 1 levels)
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:447: in method 'loadVM'
...-0.11.0/server/script/method\textDocument\completion.lua:57: in upvalue 'fastCompletion'
...-0.11.0/server/script/method\textDocument\completion.lua:133: in function 'method.textDocument.completion'
[C]: in function 'xpcall'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:62: in method '_callMethod'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:106: in method '_doProto'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:803: in method '_loadProto'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:1064: in method 'onTick'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:1087: in method 'listen'
...e\extensions\nightrains.robloxlsp-0.11.0\server\main.lua:24: in main chunk
[C]: in ?
stack traceback:
[C]: in function 'error'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:601: in method 'compileVM'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:447: in method 'loadVM'
...-0.11.0/server/script/method\textDocument\completion.lua:57: in upvalue 'fastCompletion'
...-0.11.0/server/script/method\textDocument\completion.lua:133: in function 'method.textDocument.completion'
[C]: in function 'xpcall'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:62: in method '_callMethod'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:106: in method '_doProto'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:803: in method '_loadProto'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:1064: in method 'onTick'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:1087: in method 'listen'
...e\extensions\nightrains.robloxlsp-0.11.0\server\main.lua:24: in main chunk
[C]: in ?
stack traceback:
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:106: in method '_doProto'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:803: in method '_loadProto'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:1064: in method 'onTick'
...ns/nightrains.robloxlsp-0.11.0/server/script/service.lua:1087: in method 'listen'
...e\extensions\nightrains.robloxlsp-0.11.0\server\main.lua:24: in main chunk
[C]: in ?
[Error - 8:35:10 p.m.] Request textDocument/completion failed.
Message: {
context = {
triggerCharacter = "r",
triggerKind = 2,
},
position = {
character = 14,
line = 86,
},
textDocument = {
uri = "file:///c%3A/Users/[REDACTED]/Documents/Programming/[REDACTED]/CoreUI.lua",
},
}
Thanks.
Syntax highlighter doesn't recognise intersection &
and union |
type operators or recognises type names that come after the operator when declaring variables (e.g local x: string | number
, number
wouldn't be highlighted).
Table indexer types also aren't recognised when using the array shorthand e.g {string}
or {number}
Please add support for these! 😄
These features are relatively new, so missing support is to be expected. This issue is just to bring it to your attention.
New Luau Type Checking features outlined here: https://devforum.roblox.com/t/luau-type-checking-beta/435382
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.