Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split Roblox-specific functionality into dedicated interface #505

Merged
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
10c2a63
Split Roblox-specific functionality into dedicated interface
voidedWarranties Nov 30, 2023
76e7aff
Merge branch 'main' of https://github.com/JohnnyMorganz/luau-lsp into…
JohnnyMorganz Dec 26, 2023
d3e5402
Fix frontend reference
JohnnyMorganz Dec 31, 2023
de6591f
Merge branch 'main' of https://github.com/JohnnyMorganz/luau-lsp into…
voidedWarranties Dec 31, 2023
901d216
Address initial review items
voidedWarranties Jan 1, 2024
a5319d2
Split RobloxPlatform into multiple files
voidedWarranties Jan 2, 2024
fbce308
Move some WorkspaceFileResolver functions into LSPPlatform
voidedWarranties Jan 6, 2024
9d762b7
Merge branch 'main' of https://github.com/JohnnyMorganz/luau-lsp into…
voidedWarranties Jan 6, 2024
77526ed
Fix MSVC build
voidedWarranties Jan 14, 2024
aff460b
Address review items
voidedWarranties Jan 20, 2024
9e72f06
Merge branch 'main' of https://github.com/JohnnyMorganz/luau-lsp into…
voidedWarranties Feb 23, 2024
63fdaf9
Initial extension split
voidedWarranties Feb 23, 2024
2a58485
Update extension config and config usage
voidedWarranties Feb 23, 2024
cfb8ba6
Merge branch 'main' of https://github.com/JohnnyMorganz/luau-lsp into…
voidedWarranties Apr 9, 2024
02ecb58
Resolve some issues
voidedWarranties Apr 9, 2024
7e16b8d
Merge branch 'main' of https://github.com/JohnnyMorganz/luau-lsp into…
JohnnyMorganz May 18, 2024
a60b248
Remove unused client config changes
JohnnyMorganz May 18, 2024
6b63e9a
Simplify readSourceCode
JohnnyMorganz May 18, 2024
de52f22
Merge branch 'main' into platform-specific-split
JohnnyMorganz May 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

### Deprecated
voidedWarranties marked this conversation as resolved.
Show resolved Hide resolved

- Deprecated `luau-lsp.types.roblox` setting in favour of `luau-lsp.platform.type`
- Deprecated `luau-lsp.completion.imports.suggestServices` setting in favour of `luau-lsp.platform.roblox.suggestServices`
- Deprecated `luau-lsp.sourcemap.*` settings in favour of `luau-lsp.platform.roblox.sourcemap.*`
- Deprecated `luau-lsp.plugin.*` settings in favour of `luau-lsp.platform.roblox.plugin.*`
- Deprecated `luau-lsp.types.robloxSecurityLevel` setting in favour of `luau-lsp.platform.roblox.typesSecurityLevel`

### Added

- Added `luau-lsp.platform.type` to separate platform-specific functionality from the main LSP
- Added option `--platform` to analyze CLI to make configuring `luau-lsp.platform.type` more convenient

### Changed

- Sync to upstream Luau 0.612
Expand Down
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,23 @@ target_sources(Luau.LanguageServer PRIVATE
src/Uri.cpp
src/WorkspaceFileResolver.cpp
src/Workspace.cpp
src/Sourcemap.cpp
src/TextDocument.cpp
src/Client.cpp
src/DocumentationParser.cpp
src/LuauExt.cpp
src/IostreamHelpers.cpp
src/Utils.cpp
src/StudioPlugin.cpp
src/CliConfigurationParser.cpp
src/platform/LSPPlatform.cpp
src/platform/roblox/RobloxCodeAction.cpp
src/platform/roblox/RobloxColorProvider.cpp
src/platform/roblox/RobloxCompletion.cpp
src/platform/roblox/RobloxFileResolver.cpp
src/platform/roblox/RobloxLanguageServer.cpp
src/platform/roblox/RobloxLuauExt.cpp
src/platform/roblox/RobloxSourcemap.cpp
src/platform/roblox/RobloxSourceNode.cpp
src/platform/roblox/RobloxStudioPlugin.cpp
src/operations/Diagnostics.cpp
src/operations/Completion.cpp
src/operations/DocumentSymbol.cpp
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ looking for any specific features, please get in touch!
### For Rojo Users (requires `v7.3.0+`)

By default, the latest Roblox type definitions and documentation are preloaded out of the box.
This can be disabled by configuring `luau-lsp.types.roblox`.
This can be disabled by configuring `luau-lsp.platform.type`.

The language server uses Rojo-style sourcemaps to resolve DataModel instance trees for intellisense.
This is done by running `rojo sourcemap --watch default.project.json --output sourcemap.json`.
Expand All @@ -38,10 +38,10 @@ file to your `.gitignore`.

The following settings are configurable for sourcemap generation:

- `luau-lsp.sourcemap.enabled`: Whether sourcemap support is enabled (default: on)
- `luau-lsp.sourcemap.autogenerate`: Whether sourcemaps are automatically generated by the client. If disabled, the server will listen to manual changes to a `sourcemap.json` file (default: on)
- `luau-lsp.sourcemap.rojoProjectFile`: What project file to use (default: `default.project.json`)
- `luau-lsp.sourcemap.includeNonScripts`: Whether to include non script instances in the sourcemap. May be disabled for expensive DataModels (default: on)
- `luau-lsp.platform.roblox.sourcemap.enabled`: Whether sourcemap support is enabled (default: on)
- `luau-lsp.platform.roblox.sourcemap.autogenerate`: Whether sourcemaps are automatically generated by the client. If disabled, the server will listen to manual changes to a `sourcemap.json` file (default: on)
- `luau-lsp.platform.roblox.sourcemap.rojoProjectFile`: What project file to use (default: `default.project.json`)
- `luau-lsp.platform.roblox.sourcemap.includeNonScripts`: Whether to include non script instances in the sourcemap. May be disabled for expensive DataModels (default: on)

If you do not use Rojo, you can still use the Luau Language Server, you just need to manually generate a `sourcemap.json`
file for your particular project layout.
Expand Down
114 changes: 106 additions & 8 deletions editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,31 +138,87 @@
],
"scope": "resource"
},
"luau-lsp.platform.type": {
"markdownDescription": "Platform-specific support features",
"type": "string",
"enum": [
"standard",
"roblox"
],
"scope": "window",
"default": "roblox"
},
"luau-lsp.platform.roblox.suggestServices": {
"markdownDescription": "Whether `GetService` completions are suggested in autocomplete when `#luau-lsp.completion.imports.enabled#` is `true`",
"type": "boolean",
"default": true,
"scope": "resource"
},
"luau-lsp.sourcemap.enabled": {
"markdownDescription": "Whether Rojo sourcemap parsing is enabled",
"type": "boolean",
"default": true,
"scope": "resource"
"scope": "resource",
"markdownDeprecationMessage": "**Deprecated**: Please use `#luau-lsp.platform.roblox.sourcemap.enabled#` instead.",
"deprecationMessage": "Deprecated: Please use luau-lsp.platform.roblox.sourcemap.enabled instead."
},
"luau-lsp.sourcemap.autogenerate": {
"markdownDescription": "Automatically run the `rojo sourcemap` command to regenerate sourcemaps on changes",
"type": "boolean",
"default": true,
"scope": "resource"
"scope": "resource",
"markdownDeprecationMessage": "**Deprecated**: Please use `#luau-lsp.platform.roblox.sourcemap.autogenerate#` instead.",
"deprecationMessage": "Deprecated: Please use luau-lsp.platform.roblox.sourcemap.autogenerate instead."
},
"luau-lsp.sourcemap.rojoPath": {
"markdownDescription": "Path to the Rojo executable. If not provided, attempts to run `rojo` in the workspace directory, so it must be available on the PATH",
"type": "string",
"default": null,
"scope": "resource"
"scope": "resource",
"markdownDeprecationMessage": "**Deprecated**: Please use `#luau-lsp.platform.roblox.sourcemap.rojoPath#` instead.",
"deprecationMessage": "Deprecated: Please use luau-lsp.platform.roblox.sourcemap.rojoPath instead."
},
"luau-lsp.sourcemap.rojoProjectFile": {
"markdownDescription": "The name of the Rojo project file to generate a sourcemap for.\nOnly applies if `#luau-lsp.sourcemap.autogenerate#` is enabled",
"type": "string",
"default": "default.project.json",
"scope": "resource"
"scope": "resource",
"markdownDeprecationMessage": "**Deprecated**: Please use `#luau-lsp.platform.roblox.sourcemap.rojoProjectFile#` instead.",
"deprecationMessage": "Deprecated: Please use luau-lsp.platform.roblox.sourcemap.rojoProjectFile instead."
},
"luau-lsp.sourcemap.includeNonScripts": {
"markdownDescription": "Include non-script instances in the generated sourcemap",
"type": "boolean",
"default": true,
"scope": "resource",
"markdownDeprecationMessage": "**Deprecated**: Please use `#luau-lsp.platform.roblox.sourcemap.includeNonScripts#` instead.",
"deprecationMessage": "Deprecated: Please use luau-lsp.platform.roblox.sourcemap.includeNonScripts instead."
},
"luau-lsp.platform.roblox.sourcemap.enabled": {
"markdownDescription": "Whether Rojo sourcemap parsing is enabled",
"type": "boolean",
"default": true,
"scope": "resource"
},
"luau-lsp.platform.roblox.sourcemap.autogenerate": {
"markdownDescription": "Automatically run the `rojo sourcemap` command to regenerate sourcemaps on changes",
"type": "boolean",
"default": true,
"scope": "resource"
},
"luau-lsp.platform.roblox.sourcemap.rojoPath": {
"markdownDescription": "Path to the Rojo executable. If not provided, attempts to run `rojo` in the workspace directory, so it must be available on the PATH",
"type": "string",
"default": null,
"scope": "resource"
},
"luau-lsp.platform.roblox.sourcemap.rojoProjectFile": {
"markdownDescription": "The name of the Rojo project file to generate a sourcemap for.\nOnly applies if `#luau-lsp.sourcemap.autogenerate#` is enabled",
"type": "string",
"default": "default.project.json",
"scope": "resource"
},
"luau-lsp.platform.roblox.sourcemap.includeNonScripts": {
"markdownDescription": "Include non-script instances in the generated sourcemap",
"type": "boolean",
"default": true,
Expand Down Expand Up @@ -205,6 +261,14 @@
"scope": "resource"
},
"luau-lsp.diagnostics.strictDatamodelTypes": {
"markdownDescription": "Use strict DataModel types in diagnostics. When on, this is equivalent to the more expressive autocompletion types. When this is off, `game`/`script`/`workspace` (and their members) are all typed as `any`, and helps to prevent false positives. [Read More](https://github.com/JohnnyMorganz/luau-lsp/issues/83#issuecomment-1192865024)",
"type": "boolean",
"default": false,
"scope": "resource",
"markdownDeprecationMessage": "**Deprecated**: Please use `#luau-lsp.platform.roblox.diagnostics.strictDatamodelTypes#` instead.",
"deprecationMessage": "Deprecated: Please use luau-lsp.platform.roblox.diagnostics.strictDatamodelTypes instead."
},
"luau-lsp.platform.roblox.diagnostics.strictDatamodelTypes": {
"markdownDescription": "Use strict DataModel types in diagnostics. When on, this is equivalent to the more expressive autocompletion types. When this is off, `game`/`script`/`workspace` (and their members) are all typed as `any`, and helps to prevent false positives. [Read More](https://github.com/JohnnyMorganz/luau-lsp/issues/83#issuecomment-1192865024)",
"type": "boolean",
"default": false,
Expand Down Expand Up @@ -235,9 +299,25 @@
"scope": "window",
"tags": [
"usesOnlineServices"
]
],
"markdownDeprecationMessage": "**Deprecated**: Please use `#luau-lsp.platform.type#` instead.",
"deprecationMessage": "Deprecated: Please use luau-lsp.platform.type instead."
},
"luau-lsp.types.robloxSecurityLevel": {
"markdownDescription": "Security Level to use in the Roblox API definitions",
"type": "string",
"default": "PluginSecurity",
"scope": "window",
"enum": [
"None",
"LocalUserSecurity",
"PluginSecurity",
"RobloxScriptSecurity"
],
"markdownDeprecationMessage": "**Deprecated**: Please use `#luau-lsp.platform.roblox.typesSecurityLevel#` instead.",
"deprecationMessage": "Deprecated: Please use luau-lsp.platform.roblox.typesSecurityLevel instead."
},
"luau-lsp.platform.roblox.typesSecurityLevel": {
"markdownDescription": "Security Level to use in the Roblox API definitions",
"type": "string",
"default": "PluginSecurity",
Expand Down Expand Up @@ -377,7 +457,9 @@
"markdownDescription": "Whether GetService completions are suggested in autocomplete",
"type": "boolean",
"default": true,
"scope": "resource"
"scope": "resource",
"markdownDeprecationMessage": "**Deprecated**: Please use `#luau-lsp.platform.roblox.suggestServices#` instead.",
"deprecationMessage": "Deprecated: Please use luau-lsp.platform.roblox.suggestServices instead."
},
"luau-lsp.completion.imports.suggestRequires": {
"markdownDescription": "Whether module requires are suggested in autocomplete",
Expand Down Expand Up @@ -413,18 +495,34 @@
"default": true,
"scope": "resource"
},
"luau-lsp.plugin.enabled": {
"luau-lsp.platform.roblox.plugin.enabled": {
"markdownDescription": "Use Roblox Studio Plugin to provide DataModel information",
"type": "boolean",
"default": false,
"scope": "window"
},
"luau-lsp.plugin.port": {
"luau-lsp.platform.roblox.plugin.port": {
"markdownDescription": "Port number to connect to the Studio Plugin",
"type": "number",
"default": 3667,
"scope": "window"
},
"luau-lsp.plugin.enabled": {
"markdownDescription": "Use Roblox Studio Plugin to provide DataModel information",
"type": "boolean",
"default": false,
"scope": "window",
"markdownDeprecationMessage": "**Deprecated**: Please use `#luau-lsp.platform.roblox.plugin.enabled#` instead.",
"deprecationMessage": "Deprecated: Please use luau-lsp.platform.roblox.plugin.enabled instead."
},
"luau-lsp.plugin.port": {
"markdownDescription": "Port number to connect to the Studio Plugin",
"type": "number",
"default": 3667,
"scope": "window",
"markdownDeprecationMessage": "**Deprecated**: Please use `#luau-lsp.platform.roblox.plugin.port#` instead.",
"deprecationMessage": "Deprecated: Please use luau-lsp.platform.roblox.plugin.port instead."
},
"luau-lsp.require.mode": {
"markdownDescription": "How string requires should be interpreted",
"type": "string",
Expand Down
Loading