Skip to content

Commit

Permalink
type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dig1t committed May 31, 2024
1 parent 3804424 commit 8d4df2e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: curl -L "https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/main/scripts/globalTypes.d.luau" > globalTypes.d.luau

- name: Generate sourcemaps
run: rojo sourcemap --include-non-scripts --output sourcemap.json
run: rojo sourcemap dev.project.json --include-non-scripts --output sourcemap.json

- name: Lint with luau-lsp
run: luau-lsp analyze --defs=globalTypes.d.luau --sourcemap=sourcemap.json --no-strict-dm-types --ignore=Packages/** --ignore=*.spec.lua --ignore=*.spec.luau --ignore=examples/** --ignore=modules/** --flag:LuauTinyControlFlowAnalysis=True src
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"luau-lsp.require.mode": "relativeToWorkspaceRoot",
"luau-lsp.sourcemap.autogenerate": true,
"luau-lsp.sourcemap.enabled": true,
"luau-lsp.sourcemap.rojoProjectFile": "build.project.json",
"luau-lsp.sourcemap.rojoProjectFile": "dev.project.json",
"luau-lsp.types.definitionFiles": [
"testez.d.lua"
],
Expand Down
7 changes: 4 additions & 3 deletions src/State.luau
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ end
@return number
]=]
function State.length(self: StateType): number
return Util.tableLength(self._context)
return self._context and Util.tableLength(self._context) or 0
end

--[=[
Expand Down Expand Up @@ -153,7 +153,8 @@ function State.get(self: StateType, path: string | boolean): any -- Todo: suppor
end

return path == true and self._context -- return the entire state
or Util.treePath(self._context, path, ".") -- return the value at the path
or (typeof(path) == "string" and Util.treePath(self._context, path, "."))
or nil
end

--[=[
Expand Down Expand Up @@ -415,7 +416,7 @@ end
@param path string -- The path to the value to remove
]=]
function State.remove(self: StateType, path: string)
local prevState = Util.extend({}, self._context) -- Create a local copy
local prevState = Util.extend({}, self._context or {}) -- Create a local copy
local treePath = Util.split(path, ".", true)
local res = self._context

Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.4
1.4.5

0 comments on commit 8d4df2e

Please sign in to comment.