Skip to content

Validation and enforcement of @class fields is incomplete/inconsistent #1823

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

Open
lukasbestle opened this issue Jan 15, 2023 · 4 comments
Open
Labels
enhancement New feature or request

Comments

@lukasbestle
Copy link

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

MacOS

What is the issue affecting?

Annotations, Type Checking

Expected Behaviour

When using a @class type in a type hint, lua-language-server should ensure the following code properties:

  • The type of all defined properties matches the type of that class field.
  • All required fields of the class are set.
  • No non-defined fields are set.

All of these code properties should be checked when a @param or @return type hint specifies its type to be a class or an array of classes.

Actual Behaviour

When passing a class as an argument, only wrong field types are flagged. The other properties are not checked.

When passing an array of classes as an argument, none of the properties are checked. The same applies to returning a class or array of classes.

Reproduction steps

Try the following code. Only the first example is correctly flagged. The remaining examples produce no diagnostics whatsoever.

---@class Test
---@field name string A test name
---@field description string? A test description
---@field version number A test version

---@param obj Test
local function test(obj)
end

---@param objs Test[]
local function testMultiple(objs)
end

---------------------------------------
-- Working example

function Example1()
  test {
    name = "Test",
    description = false -- invalid type
  }
end

---------------------------------------
-- Currently not working examples

function Example2()
  test {
    name = "Test",
    -- version field is missing
  }
end

function Example3()
  test {
    name = "Test",
    label = "Test" -- non-existing field
  }
end

function Example4()
  local list = {}

  table.insert(list, {
    name = "Test",
    description = false -- invalid type
  })

  testMultiple(list)
end

---@return Test
function Example5()
  return {
    name = "Test",
    description = false -- invalid type
  }
end

---@return Test[]
function Example6()
  local list = {}

  table.insert(list, {
    name = "Test",
    description = false -- invalid type
  })

  return list
end

Additional Notes

No response

Log File

[16:49:31.671][info] [#0:/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/main.lua:66]: Lua Lsp startup, root: 	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server
[16:49:31.672][info] [#0:/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/main.lua:67]: ROOT:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server
[16:49:31.672][info] [#0:/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/main.lua:68]: LOGPATH:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/log
[16:49:31.672][info] [#0:/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/main.lua:69]: METAPATH:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta
[16:49:31.672][info] [#0:/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/main.lua:70]: VERSION:	3.6.4-dev
[16:49:31.703][debug][#0:script/service/telemetry.lua:22]: Telemetry Token:	...
[16:49:31.715][debug][#0:script/pub/pub.lua:50]: Create brave:	1
[16:49:31.715][debug][#0:script/pub/pub.lua:50]: Create brave:	2
[16:49:31.716][debug][#0:script/pub/pub.lua:50]: Create brave:	3
[16:49:31.716][debug][#0:script/pub/pub.lua:50]: Create brave:	4
[16:49:31.716][info] [#0:script/service/service.lua:141]:
========= Medical Examination Report =========
    --------------- Memory ---------------
        Total: 1.566 MB
        # 00 : 1.566 MB
        # 01 : 0.000 MB
        # 02 : 0.000 MB
        # 03 : 0.000 MB
        # 04 : 0.000 MB
    --------------- Coroutine ---------------
        Total:     0
        Running:   0
        Suspended: 0
        Normal:    0
        Dead:      0
    --------------- Cache ---------------
        Total: 1
        Dead:  0
    ---------------  RPC  ---------------
        Holdon:   0
        Waiting:  0
==============================================
[16:49:31.730][debug][#0:script/client.lua:463]: Client init	{
  capabilities = {
    general = {
      markdown = {
        allowedTags = { "ul", "li", "p", "code", "blockquote", "ol", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "em", "pre", "table", "thead", "tbody", "tr", "th", "td", "div", "del", "a", "strong", "br", "img", "span" },
        parser = "marked",
        version = "1.1.0"
      },
      positionEncodings = { "utf-16" },
      regularExpressions = {
        engine = "ECMAScript",
        version = "ES2020"
      },
      staleRequestSupport = {
        cancel = true,
        retryOnContentModified = { "textDocument/semanticTokens/full", "textDocument/semanticTokens/range", "textDocument/semanticTokens/full/delta" }
      }
    },
    notebookDocument = {
      synchronization = {
        dynamicRegistration = true,
        executionSummarySupport = true
      }
    },
    textDocument = {
      callHierarchy = {
        dynamicRegistration = true
      },
      codeAction = {
        codeActionLiteralSupport = {
          codeActionKind = {
            valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }
          }
        },
        dataSupport = true,
        disabledSupport = true,
        dynamicRegistration = true,
        honorsChangeAnnotations = false,
        isPreferredSupport = true,
        resolveSupport = {
          properties = { "edit" }
        }
      },
      codeLens = {
        dynamicRegistration = true
      },
      colorProvider = {
        dynamicRegistration = true
      },
      completion = {
        completionItem = {
          commitCharactersSupport = true,
          deprecatedSupport = true,
          documentationFormat = { "markdown", "plaintext" },
          insertReplaceSupport = true,
          insertTextModeSupport = {
            valueSet = { 1, 2 }
          },
          labelDetailsSupport = true,
          preselectSupport = true,
          resolveSupport = {
            properties = { "documentation", "detail", "additionalTextEdits" }
          },
          snippetSupport = true,
          tagSupport = {
            valueSet = { 1 }
          }
        },
        completionItemKind = {
          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }
        },
        completionList = {
          itemDefaults = { "commitCharacters", "editRange", "insertTextFormat", "insertTextMode" }
        },
        contextSupport = true,
        dynamicRegistration = true,
        insertTextMode = 2
      },
      declaration = {
        dynamicRegistration = true,
        linkSupport = true
      },
      definition = {
        dynamicRegistration = true,
        linkSupport = true
      },
      diagnostic = {
        dynamicRegistration = true,
        relatedDocumentSupport = false
      },
      documentHighlight = {
        dynamicRegistration = true
      },
      documentLink = {
        dynamicRegistration = true,
        tooltipSupport = true
      },
      documentSymbol = {
        dynamicRegistration = true,
        hierarchicalDocumentSymbolSupport = true,
        labelSupport = true,
        symbolKind = {
          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }
        },
        tagSupport = {
          valueSet = { 1 }
        }
      },
      foldingRange = {
        dynamicRegistration = true,
        foldingRange = {
          collapsedText = false
        },
        foldingRangeKind = {
          valueSet = { "comment", "imports", "region" }
        },
        lineFoldingOnly = true,
        rangeLimit = 5000
      },
      formatting = {
        dynamicRegistration = true
      },
      hover = {
        contentFormat = { "markdown", "plaintext" },
        dynamicRegistration = true
      },
      implementation = {
        dynamicRegistration = true,
        linkSupport = true
      },
      inlayHint = {
        dynamicRegistration = true,
        resolveSupport = {
          properties = { "tooltip", "textEdits", "label.tooltip", "label.location", "label.command" }
        }
      },
      inlineValue = {
        dynamicRegistration = true
      },
      linkedEditingRange = {
        dynamicRegistration = true
      },
      onTypeFormatting = {
        dynamicRegistration = true
      },
      publishDiagnostics = {
        codeDescriptionSupport = true,
        dataSupport = true,
        relatedInformation = true,
        tagSupport = {
          valueSet = { 1, 2 }
        },
        versionSupport = false
      },
      rangeFormatting = {
        dynamicRegistration = true
      },
      references = {
        dynamicRegistration = true
      },
      rename = {
        dynamicRegistration = true,
        honorsChangeAnnotations = true,
        prepareSupport = true,
        prepareSupportDefaultBehavior = 1
      },
      selectionRange = {
        dynamicRegistration = true
      },
      semanticTokens = {
        augmentsSyntaxTokens = true,
        dynamicRegistration = true,
        formats = { "relative" },
        multilineTokenSupport = false,
        overlappingTokenSupport = false,
        requests = {
          full = {
            delta = true
          },
          range = true
        },
        serverCancelSupport = true,
        tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },
        tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }
      },
      signatureHelp = {
        contextSupport = true,
        dynamicRegistration = true,
        signatureInformation = {
          activeParameterSupport = true,
          documentationFormat = { "markdown", "plaintext" },
          parameterInformation = {
            labelOffsetSupport = true
          }
        }
      },
      synchronization = {
        didSave = true,
        dynamicRegistration = true,
        willSave = true,
        willSaveWaitUntil = true
      },
      typeDefinition = {
        dynamicRegistration = true,
        linkSupport = true
      },
      typeHierarchy = {
        dynamicRegistration = true
      }
    },
    window = {
      showDocument = {
        support = true
      },
      showMessage = {
        messageActionItem = {
          additionalPropertiesSupport = true
        }
      },
      workDoneProgress = true
    },
    workspace = {
      applyEdit = true,
      codeLens = {
        refreshSupport = true
      },
      configuration = true,
      diagnostics = {
        refreshSupport = true
      },
      didChangeConfiguration = {
        dynamicRegistration = true
      },
      didChangeWatchedFiles = {
        dynamicRegistration = true,
        relativePatternSupport = true
      },
      executeCommand = {
        dynamicRegistration = true
      },
      fileOperations = {
        didCreate = true,
        didDelete = true,
        didRename = true,
        dynamicRegistration = true,
        willCreate = true,
        willDelete = true,
        willRename = true
      },
      inlayHint = {
        refreshSupport = true
      },
      inlineValue = {
        refreshSupport = true
      },
      semanticTokens = {
        refreshSupport = true
      },
      symbol = {
        dynamicRegistration = true,
        resolveSupport = {
          properties = { "location.range" }
        },
        symbolKind = {
          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }
        },
        tagSupport = {
          valueSet = { 1 }
        }
      },
      workspaceEdit = {
        changeAnnotationSupport = {
          groupsOnLabel = true
        },
        documentChanges = true,
        failureHandling = "textOnlyTransactional",
        normalizesLineEndings = true,
        resourceOperations = { "create", "rename", "delete" }
      },
      workspaceFolders = true
    }
  },
  clientInfo = {
    name = "Visual Studio Code",
    version = "1.74.3"
  },
  initializationOptions = {
    changeConfiguration = true
  },
  locale = "de",
  processId = 21136,
  rootPath = "/Users/user/Desktop/Test",
  rootUri = "file:///Users/user/Desktop/Test",
  trace = "off",
  workDoneToken = "16981c02-6465-4e24-b677-f9b289c36125",
  workspaceFolders = { {
      name = "Test",
      uri = "file:///Users/user/Desktop/Test"
    } }
}
[16:49:31.730][info] [#0:script/language.lua:137]: VSC language: de
[16:49:31.730][info] [#0:script/language.lua:138]: LS  language: en-us
[16:49:31.730][info] [#0:script/workspace/workspace.lua:38]: Workspace init root: 	file:///Users/user/Desktop/Test
[16:49:31.731][info] [#0:script/workspace/workspace.lua:42]: Log path: 	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/log/file_Users_lux_Desktop_Test.log
[16:49:31.733][info] [#0:script/workspace/workspace.lua:51]: Workspace create: 	file:///Users/user/Desktop/Test
[16:49:31.734][debug][#0:script/provider/provider.lua:129]: Server init	{
  capabilities = {
    codeActionProvider = {
      codeActionKinds = { "", "quickfix", "refactor.rewrite", "refactor.extract" },
      resolveProvider = false
    },
    colorProvider = true,
    definitionProvider = true,
    documentFormattingProvider = true,
    documentHighlightProvider = true,
    documentOnTypeFormattingProvider = {
      firstTriggerCharacter = "\n"
    },
    documentRangeFormattingProvider = true,
    documentSymbolProvider = true,
    executeCommandProvider = {
      commands = { "lua.removeSpace", "lua.solve", "lua.jsonToLua", "lua.setConfig", "lua.autoRequire" }
    },
    foldingRangeProvider = true,
    hoverProvider = true,
    inlayHintProvider = {
      resolveProvider = true
    },
    offsetEncoding = "utf-16",
    referencesProvider = true,
    renameProvider = {
      prepareProvider = true
    },
    semanticTokensProvider = {
      legend = {
        tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary", "global" },
        tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }
      },
      range = true
    },
    signatureHelpProvider = {
      triggerCharacters = { "(", "," }
    },
    textDocumentSync = {
      change = 2,
      openClose = true,
      save = {
        includeText = false
      }
    },
    typeDefinitionProvider = true,
    workspace = {
      fileOperations = {
        didRename = {
          filters = { {
              pattern = {
                glob = "/Users/user/Desktop/Test/**",
                options = {
                  ignoreCase = true
                }
              }
            } }
        }
      },
      workspaceFolders = {
        changeNotifications = true,
        supported = true
      }
    },
    workspaceSymbolProvider = true
  },
  serverInfo = {
    name = "sumneko.lua"
  }
}
[16:49:31.838][debug][#0:script/provider/provider.lua:267]: didOpen	file:///Users/user/Desktop/Test/Test.lua
[16:49:31.839][trace][#0:script/files.lua:275]: Set text:	file:///Users/user/Desktop/Test/Test.lua	takes	0.00059100000000001	sec.
[16:49:31.944][info] [#0:script/provider/provider.lua:41]: Load config from client	file:///Users/user/Desktop/Test
[16:49:31.947][info] [#0:script/provider/provider.lua:42]: {
  Lua = {
    completion = {
      autoRequire = true,
      callSnippet = "Disable",
      displayContext = 0,
      enable = true,
      keywordSnippet = "Replace",
      postfix = "@",
      requireSeparator = ".",
      showParams = true,
      showWord = "Fallback",
      workspaceWord = true
    },
    diagnostics = {
      disable = {},
      disableScheme = { "git" },
      enable = true,
      globals = {},
      groupFileStatus = {},
      groupSeverity = {},
      ignoredFiles = "Opened",
      libraryFiles = "Opened",
      neededFileStatus = {},
      severity = {},
      unusedLocalExclude = {},
      workspaceDelay = 3000,
      workspaceEvent = "OnSave",
      workspaceRate = 100
    },
    doc = {
      packageName = {},
      privateName = {},
      protectedName = {}
    },
    format = {
      defaultConfig = {},
      enable = true
    },
    hint = {
      arrayIndex = "Auto",
      await = true,
      enable = false,
      paramName = "All",
      paramType = true,
      semicolon = "SameLine",
      setType = false
    },
    hover = {
      enable = true,
      enumsLimit = 5,
      expandAlias = true,
      previewFields = 50,
      viewNumber = true,
      viewString = true,
      viewStringMax = 1000
    },
    misc = {
      executablePath = "",
      parameters = { "--loglevel=trace" }
    },
    runtime = {
      builtin = {},
      fileEncoding = "utf8",
      meta = "${version} ${language} ${encoding}",
      nonstandardSymbol = {},
      path = { "?.lua", "?/init.lua" },
      pathStrict = false,
      plugin = "",
      pluginArgs = {},
      special = {},
      unicodeName = false,
      version = "Lua 5.4"
    },
    semantic = {
      annotation = true,
      enable = true,
      keyword = false,
      variable = true
    },
    signatureHelp = {
      enable = true
    },
    spell = {
      dict = {}
    },
    telemetry = {
      enable = false
    },
    type = {
      castNumberToInteger = true,
      weakNilCheck = false,
      weakUnionCheck = false
    },
    typeFormat = {
      config = {}
    },
    window = {
      progressBar = true,
      statusBar = true
    },
    workspace = {
      checkThirdParty = true,
      ignoreDir = { ".vscode" },
      ignoreSubmodules = true,
      library = {},
      maxPreload = 5000,
      preloadFileSize = 500,
      supportScheme = { "file", "untitled", "git" },
      useGitIgnore = true,
      userThirdParty = {}
    }
  },
  ["editor.acceptSuggestionOnEnter"] = "off",
  ["editor.semanticHighlighting.enabled"] = "configuredByTheme",
  ["files.associations"] = {},
  ["files.exclude"] = {
    ["**/.DS_Store"] = true,
    ["**/.git"] = true,
    ["**/.hg"] = true,
    ["**/.svn"] = true,
    ["**/CVS"] = true,
    ["**/Thumbs.db"] = true
  }
}
[16:49:32.052][info] [#0:script/provider/completion.lua:43]: Enable completion.
[16:49:32.053][info] [#0:script/provider/provider.lua:56]: Load config from client	fallback
[16:49:32.057][info] [#0:script/provider/provider.lua:57]: {
  Lua = {
    completion = {
      autoRequire = true,
      callSnippet = "Disable",
      displayContext = 0,
      enable = true,
      keywordSnippet = "Replace",
      postfix = "@",
      requireSeparator = ".",
      showParams = true,
      showWord = "Fallback",
      workspaceWord = true
    },
    diagnostics = {
      disable = {},
      disableScheme = { "git" },
      enable = true,
      globals = {},
      groupFileStatus = {},
      groupSeverity = {},
      ignoredFiles = "Opened",
      libraryFiles = "Opened",
      neededFileStatus = {},
      severity = {},
      unusedLocalExclude = {},
      workspaceDelay = 3000,
      workspaceEvent = "OnSave",
      workspaceRate = 100
    },
    doc = {
      packageName = {},
      privateName = {},
      protectedName = {}
    },
    format = {
      defaultConfig = {},
      enable = true
    },
    hint = {
      arrayIndex = "Auto",
      await = true,
      enable = false,
      paramName = "All",
      paramType = true,
      semicolon = "SameLine",
      setType = false
    },
    hover = {
      enable = true,
      enumsLimit = 5,
      expandAlias = true,
      previewFields = 50,
      viewNumber = true,
      viewString = true,
      viewStringMax = 1000
    },
    misc = {
      executablePath = "",
      parameters = { "--loglevel=trace" }
    },
    runtime = {
      builtin = {},
      fileEncoding = "utf8",
      meta = "${version} ${language} ${encoding}",
      nonstandardSymbol = {},
      path = { "?.lua", "?/init.lua" },
      pathStrict = false,
      plugin = "",
      pluginArgs = {},
      special = {},
      unicodeName = false,
      version = "Lua 5.4"
    },
    semantic = {
      annotation = true,
      enable = true,
      keyword = false,
      variable = true
    },
    signatureHelp = {
      enable = true
    },
    spell = {
      dict = {}
    },
    telemetry = {
      enable = false
    },
    type = {
      castNumberToInteger = true,
      weakNilCheck = false,
      weakUnionCheck = false
    },
    typeFormat = {
      config = {}
    },
    window = {
      progressBar = true,
      statusBar = true
    },
    workspace = {
      checkThirdParty = true,
      ignoreDir = { ".vscode" },
      ignoreSubmodules = true,
      library = {},
      maxPreload = 5000,
      preloadFileSize = 500,
      supportScheme = { "file", "untitled", "git" },
      useGitIgnore = true,
      userThirdParty = {}
    }
  },
  ["editor.acceptSuggestionOnEnter"] = "off",
  ["editor.semanticHighlighting.enabled"] = "configuredByTheme",
  ["files.associations"] = {},
  ["files.exclude"] = {
    ["**/.DS_Store"] = true,
    ["**/.git"] = true,
    ["**/.hg"] = true,
    ["**/.svn"] = true,
    ["**/CVS"] = true,
    ["**/Thumbs.db"] = true
  }
}
[16:49:32.159][info] [#0:script/library.lua:209]: Init builtin library at:	file:///Users/user/Desktop/Test
[16:49:32.163][debug][#0:script/library.lua:244]: Builtin status:	table.clear	default
[16:49:32.164][debug][#0:script/library.lua:244]: Builtin status:	debug	default
[16:49:32.166][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/debug.lua
[16:49:32.166][debug][#0:script/library.lua:244]: Builtin status:	builtin	default
[16:49:32.168][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/builtin.lua
[16:49:32.168][debug][#0:script/library.lua:244]: Builtin status:	table	default
[16:49:32.171][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/table.lua
[16:49:32.171][debug][#0:script/library.lua:244]: Builtin status:	os	default
[16:49:32.173][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/os.lua
[16:49:32.173][debug][#0:script/library.lua:244]: Builtin status:	coroutine	default
[16:49:32.176][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/coroutine.lua
[16:49:32.176][debug][#0:script/library.lua:244]: Builtin status:	basic	default
[16:49:32.184][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/basic.lua
[16:49:32.185][debug][#0:script/library.lua:244]: Builtin status:	io	default
[16:49:32.190][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/io.lua
[16:49:32.190][debug][#0:script/library.lua:244]: Builtin status:	utf8	default
[16:49:32.192][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/utf8.lua
[16:49:32.193][debug][#0:script/library.lua:244]: Builtin status:	package	default
[16:49:32.194][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/package.lua
[16:49:32.194][debug][#0:script/library.lua:244]: Builtin status:	jit	default
[16:49:32.195][debug][#0:script/library.lua:244]: Builtin status:	ffi	default
[16:49:32.195][debug][#0:script/library.lua:244]: Builtin status:	math	default
[16:49:32.202][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/math.lua
[16:49:32.202][debug][#0:script/library.lua:244]: Builtin status:	string.buffer	default
[16:49:32.204][debug][#0:script/library.lua:244]: Builtin status:	bit32	default
[16:49:32.205][debug][#0:script/library.lua:244]: Builtin status:	string	default
[16:49:32.212][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/string.lua
[16:49:32.212][debug][#0:script/library.lua:244]: Builtin status:	table.new	default
[16:49:32.213][debug][#0:script/library.lua:244]: Builtin status:	bit	default
[16:49:32.216][info] [#0:script/plugin.lua:86]: plugin path:	/Users/user/Desktop/Test
[16:49:32.216][warn] [#0:script/plugin.lua:101]: plugin not found:	/Users/user/Desktop/Test
[16:49:32.216][info] [#0:script/library.lua:209]: Init builtin library at:	nil
[16:49:32.225][debug][#0:script/library.lua:244]: Builtin status:	table.clear	default
[16:49:32.225][debug][#0:script/library.lua:244]: Builtin status:	debug	default
[16:49:32.227][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/debug.lua
[16:49:32.227][debug][#0:script/library.lua:244]: Builtin status:	builtin	default
[16:49:32.229][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/builtin.lua
[16:49:32.229][debug][#0:script/library.lua:244]: Builtin status:	table	default
[16:49:32.230][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/table.lua
[16:49:32.230][debug][#0:script/library.lua:244]: Builtin status:	os	default
[16:49:32.231][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/os.lua
[16:49:32.232][debug][#0:script/library.lua:244]: Builtin status:	coroutine	default
[16:49:32.232][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/coroutine.lua
[16:49:32.232][debug][#0:script/library.lua:244]: Builtin status:	basic	default
[16:49:32.237][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/basic.lua
[16:49:32.237][debug][#0:script/library.lua:244]: Builtin status:	io	default
[16:49:32.239][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/io.lua
[16:49:32.239][debug][#0:script/library.lua:244]: Builtin status:	utf8	default
[16:49:32.240][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/utf8.lua
[16:49:32.240][debug][#0:script/library.lua:244]: Builtin status:	package	default
[16:49:32.242][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/package.lua
[16:49:32.242][debug][#0:script/library.lua:244]: Builtin status:	jit	default
[16:49:32.244][debug][#0:script/library.lua:244]: Builtin status:	ffi	default
[16:49:32.245][debug][#0:script/library.lua:244]: Builtin status:	math	default
[16:49:32.248][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/math.lua
[16:49:32.248][debug][#0:script/library.lua:244]: Builtin status:	string.buffer	default
[16:49:32.250][debug][#0:script/library.lua:244]: Builtin status:	bit32	default
[16:49:32.252][debug][#0:script/library.lua:244]: Builtin status:	string	default
[16:49:32.256][debug][#0:script/library.lua:268]: Meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8/string.lua
[16:49:32.256][debug][#0:script/library.lua:244]: Builtin status:	table.new	default
[16:49:32.258][debug][#0:script/library.lua:244]: Builtin status:	bit	default
[16:49:32.264][debug][#0:script/provider/provider.lua:1048]: textDocument/semanticTokens/range
[16:49:32.264][info] [#0:script/workspace/workspace.lua:304]: Preload start:	file:///Users/user/Desktop/Test
[16:49:32.264][debug][#0:script/workspace/workspace.lua:126]: Ignore by exclude:	**/CVS
[16:49:32.264][debug][#0:script/workspace/workspace.lua:126]: Ignore by exclude:	**/Thumbs.db
[16:49:32.264][debug][#0:script/workspace/workspace.lua:126]: Ignore by exclude:	**/.git
[16:49:32.264][debug][#0:script/workspace/workspace.lua:126]: Ignore by exclude:	**/.svn
[16:49:32.264][debug][#0:script/workspace/workspace.lua:126]: Ignore by exclude:	**/.DS_Store
[16:49:32.264][debug][#0:script/workspace/workspace.lua:126]: Ignore by exclude:	**/.hg
[16:49:32.264][debug][#0:script/workspace/workspace.lua:167]: Ignore directory:	.vscode
[16:49:32.264][debug][#0:script/workspace/workspace.lua:186]: Build library matchers:	{scope|folder|file:///Users/user/Desktop/Test}
[16:49:32.264][debug][#0:script/workspace/workspace.lua:191]: Ignore by exclude:	**/CVS
[16:49:32.264][debug][#0:script/workspace/workspace.lua:191]: Ignore by exclude:	**/Thumbs.db
[16:49:32.264][debug][#0:script/workspace/workspace.lua:191]: Ignore by exclude:	**/.git
[16:49:32.264][debug][#0:script/workspace/workspace.lua:191]: Ignore by exclude:	**/.svn
[16:49:32.264][debug][#0:script/workspace/workspace.lua:191]: Ignore by exclude:	**/.DS_Store
[16:49:32.264][debug][#0:script/workspace/workspace.lua:191]: Ignore by exclude:	**/.hg
[16:49:32.264][debug][#0:script/workspace/workspace.lua:196]: Ignore directory:	.vscode
[16:49:32.264][debug][#0:script/workspace/workspace.lua:207]: meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8
[16:49:32.266][debug][#0:script/workspace/workspace.lua:228]: library matcher:	{ {
    matcher = {
      errors = {},
      interface = {
        list = <function 1>,
        type = <function 2>
      },
      matcher = { {
          matcher = <userdata 1>,
          state = { {
              type = "**",
              value = "**"
            }, {
              type = "/",
              value = "/"
            }, {
              type = "word",
              value = { {
                  type = "char",
                  value = "CVS"
                } }
            } },
          <metatable> = <1>{
            __call = <function 3>,
            __index = <table 1>,
            __name = "matcher",
            anyChar = <function 4>,
            anyPath = <function 5>,
            char = <function 6>,
            exp = <function 7>,
            isNeedDirectory = <function 8>,
            isNegative = <function 9>,
            oneChar = <function 10>,
            pattern = <function 11>,
            range = <function 12>,
            slash = <function 13>,
            word = <function 14>
          }
        }, {
          matcher = <userdata 2>,
          state = { {
              type = "**",
              value = "**"
            }, {
              type = "/",
              value = "/"
            }, {
              type = "word",
              value = { {
                  type = "char",
                  value = "Thumbs.db"
                } }
            } },
          <metatable> = <table 1>
        }, {
          matcher = <userdata 3>,
          state = { {
              type = "**",
              value = "**"
            }, {
              type = "/",
              value = "/"
            }, {
              type = "word",
              value = { {
                  type = "char",
                  value = ".git"
                } }
            } },
          <metatable> = <table 1>
        }, {
          matcher = <userdata 4>,
          state = { {
              type = "**",
              value = "**"
            }, {
              type = "/",
              value = "/"
            }, {
              type = "word",
              value = { {
                  type = "char",
                  value = ".svn"
                } }
            } },
          <metatable> = <table 1>
        }, {
          matcher = <userdata 5>,
          state = { {
              type = "**",
              value = "**"
            }, {
              type = "/",
              value = "/"
            }, {
              type = "word",
              value = { {
                  type = "char",
                  value = ".DS_Store"
                } }
            } },
          <metatable> = <table 1>
        }, {
          matcher = <userdata 6>,
          state = { {
              type = "**",
              value = "**"
            }, {
              type = "/",
              value = "/"
            }, {
              type = "word",
              value = { {
                  type = "char",
                  value = ".hg"
                } }
            } },
          <metatable> = <table 1>
        }, {
          matcher = <userdata 7>,
          state = { {
              type = "word",
              value = { {
                  type = "char",
                  value = ".vscode"
                } }
            } },
          <metatable> = <table 1>
        } },
      options = {
        ignoreCase = false,
        root = "/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8"
      },
      pattern = { "**/CVS", "**/Thumbs.db", "**/.git", "**/.svn", "**/.DS_Store", "**/.hg", ".vscode" },
      <metatable> = <2>{
        __call = <function 15>,
        __index = <table 2>,
        __name = "gitignore",
        addPattern = <function 16>,
        callInterface = <function 17>,
        checkDirectory = <function 18>,
        finishMatch = <function 19>,
        getRelativePath = <function 20>,
        hasInterface = <function 21>,
        scan = <function 22>,
        setInterface = <function 23>,
        setOption = <function 24>,
        simpleMatch = <function 25>
      }
    },
    uri = "file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8"
  } }
[16:49:32.266][info] [#0:script/workspace/workspace.lua:310]: Scan files at:	file:///Users/user/Desktop/Test
[16:49:32.267][debug][#0:script/filewatch.lua:46]: fw.add	/Users/user/Desktop/Test
[16:49:32.267][info] [#0:script/workspace/workspace.lua:304]: Preload start:	<fallback>
[16:49:32.267][debug][#0:script/workspace/workspace.lua:126]: Ignore by exclude:	**/CVS
[16:49:32.267][debug][#0:script/workspace/workspace.lua:126]: Ignore by exclude:	**/Thumbs.db
[16:49:32.267][debug][#0:script/workspace/workspace.lua:126]: Ignore by exclude:	**/.git
[16:49:32.267][debug][#0:script/workspace/workspace.lua:126]: Ignore by exclude:	**/.svn
[16:49:32.267][debug][#0:script/workspace/workspace.lua:126]: Ignore by exclude:	**/.DS_Store
[16:49:32.267][debug][#0:script/workspace/workspace.lua:126]: Ignore by exclude:	**/.hg
[16:49:32.267][debug][#0:script/workspace/workspace.lua:167]: Ignore directory:	.vscode
[16:49:32.268][debug][#0:script/workspace/workspace.lua:186]: Build library matchers:	{scope|fallback}
[16:49:32.268][debug][#0:script/workspace/workspace.lua:191]: Ignore by exclude:	**/CVS
[16:49:32.268][debug][#0:script/workspace/workspace.lua:191]: Ignore by exclude:	**/Thumbs.db
[16:49:32.268][debug][#0:script/workspace/workspace.lua:191]: Ignore by exclude:	**/.git
[16:49:32.268][debug][#0:script/workspace/workspace.lua:191]: Ignore by exclude:	**/.svn
[16:49:32.268][debug][#0:script/workspace/workspace.lua:191]: Ignore by exclude:	**/.DS_Store
[16:49:32.268][debug][#0:script/workspace/workspace.lua:191]: Ignore by exclude:	**/.hg
[16:49:32.268][debug][#0:script/workspace/workspace.lua:196]: Ignore directory:	.vscode
[16:49:32.268][debug][#0:script/workspace/workspace.lua:207]: meta path:	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8
[16:49:32.270][debug][#0:script/workspace/workspace.lua:228]: library matcher:	{ {
    matcher = {
      errors = {},
      interface = {
        list = <function 1>,
        type = <function 2>
      },
      matcher = { {
          matcher = <userdata 1>,
          state = { {
              type = "**",
              value = "**"
            }, {
              type = "/",
              value = "/"
            }, {
              type = "word",
              value = { {
                  type = "char",
                  value = "CVS"
                } }
            } },
          <metatable> = <1>{
            __call = <function 3>,
            __index = <table 1>,
            __name = "matcher",
            anyChar = <function 4>,
            anyPath = <function 5>,
            char = <function 6>,
            exp = <function 7>,
            isNeedDirectory = <function 8>,
            isNegative = <function 9>,
            oneChar = <function 10>,
            pattern = <function 11>,
            range = <function 12>,
            slash = <function 13>,
            word = <function 14>
          }
        }, {
          matcher = <userdata 2>,
          state = { {
              type = "**",
              value = "**"
            }, {
              type = "/",
              value = "/"
            }, {
              type = "word",
              value = { {
                  type = "char",
                  value = "Thumbs.db"
                } }
            } },
          <metatable> = <table 1>
        }, {
          matcher = <userdata 3>,
          state = { {
              type = "**",
              value = "**"
            }, {
              type = "/",
              value = "/"
            }, {
              type = "word",
              value = { {
                  type = "char",
                  value = ".git"
                } }
            } },
          <metatable> = <table 1>
        }, {
          matcher = <userdata 4>,
          state = { {
              type = "**",
              value = "**"
            }, {
              type = "/",
              value = "/"
            }, {
              type = "word",
              value = { {
                  type = "char",
                  value = ".svn"
                } }
            } },
          <metatable> = <table 1>
        }, {
          matcher = <userdata 5>,
          state = { {
              type = "**",
              value = "**"
            }, {
              type = "/",
              value = "/"
            }, {
              type = "word",
              value = { {
                  type = "char",
                  value = ".DS_Store"
                } }
            } },
          <metatable> = <table 1>
        }, {
          matcher = <userdata 6>,
          state = { {
              type = "**",
              value = "**"
            }, {
              type = "/",
              value = "/"
            }, {
              type = "word",
              value = { {
                  type = "char",
                  value = ".hg"
                } }
            } },
          <metatable> = <table 1>
        }, {
          matcher = <userdata 7>,
          state = { {
              type = "word",
              value = { {
                  type = "char",
                  value = ".vscode"
                } }
            } },
          <metatable> = <table 1>
        } },
      options = {
        ignoreCase = false,
        root = "/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8"
      },
      pattern = { "**/CVS", "**/Thumbs.db", "**/.git", "**/.svn", "**/.DS_Store", "**/.hg", ".vscode" },
      <metatable> = <2>{
        __call = <function 15>,
        __index = <table 2>,
        __name = "gitignore",
        addPattern = <function 16>,
        callInterface = <function 17>,
        checkDirectory = <function 18>,
        finishMatch = <function 19>,
        getRelativePath = <function 20>,
        hasInterface = <function 21>,
        scan = <function 22>,
        setInterface = <function 23>,
        setOption = <function 24>,
        simpleMatch = <function 25>
      }
    },
    uri = "file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8"
  } }
[16:49:32.270][info] [#0:script/workspace/workspace.lua:327]: Scan library at:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.271][debug][#0:script/filewatch.lua:46]: fw.add	/Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua 5.4 en-us utf8
[16:49:32.272][info] [#0:script/workspace/workspace.lua:327]: Scan library at:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.377][info] [#0:script/workspace/workspace.lua:347]: Found 11 files at:	<fallback>
[16:49:32.377][info] [#0:script/workspace/loading.lua:157]: Load files from disk:	<fallback>
[16:49:32.377][info] [#0:script/workspace/workspace.lua:347]: Found 12 files at:	file:///Users/user/Desktop/Test
[16:49:32.377][info] [#0:script/workspace/loading.lua:157]: Load files from disk:	file:///Users/user/Desktop/Test
[16:49:32.378][debug][#0:script/files.lua:435]: add ref	file:///Users/user/Desktop/Test/Test.lua	1
[16:49:32.378][debug][#0:script/workspace/loading.lua:89]: Skip loaded file: file:///Users/user/Desktop/Test/Test.lua
[16:49:32.484][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/builtin.lua , size = 0.300 KB
[16:49:32.484][trace][#0:script/files.lua:275]: Set text:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/builtin.lua	takes	0.00022000000000003	sec.
[16:49:32.484][trace][#0:script/files.lua:674]: Compile State:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/builtin.lua
[16:49:32.486][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/builtin.lua	1
[16:49:32.486][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.487][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/package.lua , size = 3.042 KB
[16:49:32.487][trace][#0:script/files.lua:275]: Set text:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/package.lua	takes	0.00015899999999999	sec.
[16:49:32.487][trace][#0:script/files.lua:674]: Compile State:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/package.lua
[16:49:32.489][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/package.lua	1
[16:49:32.489][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.489][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/builtin.lua , size = 0.300 KB
[16:49:32.489][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/builtin.lua	2
[16:49:32.489][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.489][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/package.lua , size = 3.042 KB
[16:49:32.489][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/package.lua	2
[16:49:32.489][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.489][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/utf8.lua , size = 2.442 KB
[16:49:32.490][trace][#0:script/files.lua:275]: Set text:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/utf8.lua	takes	0.00015499999999999	sec.
[16:49:32.490][trace][#0:script/files.lua:674]: Compile State:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/utf8.lua
[16:49:32.492][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/utf8.lua	1
[16:49:32.492][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.492][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/utf8.lua , size = 2.442 KB
[16:49:32.492][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/utf8.lua	2
[16:49:32.492][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.492][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/io.lua , size = 6.620 KB
[16:49:32.492][trace][#0:script/files.lua:275]: Set text:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/io.lua	takes	0.000108	sec.
[16:49:32.493][trace][#0:script/files.lua:674]: Compile State:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/io.lua
[16:49:32.499][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/io.lua	1
[16:49:32.499][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.499][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/io.lua , size = 6.620 KB
[16:49:32.499][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/io.lua	2
[16:49:32.499][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.499][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/debug.lua , size = 7.828 KB
[16:49:32.499][trace][#0:script/files.lua:275]: Set text:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/debug.lua	takes	0.00010099999999999	sec.
[16:49:32.499][trace][#0:script/files.lua:674]: Compile State:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/debug.lua
[16:49:32.504][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/debug.lua	1
[16:49:32.504][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.505][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/debug.lua , size = 7.828 KB
[16:49:32.505][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/debug.lua	2
[16:49:32.505][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.505][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/coroutine.lua , size = 2.659 KB
[16:49:32.505][trace][#0:script/files.lua:275]: Set text:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/coroutine.lua	takes	0.000113sec.
[16:49:32.505][trace][#0:script/files.lua:674]: Compile State:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/coroutine.lua
[16:49:32.506][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/coroutine.lua	1
[16:49:32.506][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.506][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/coroutine.lua , size = 2.659 KB
[16:49:32.506][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/coroutine.lua	2
[16:49:32.507][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.507][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/math.lua , size = 9.017 KB
[16:49:32.507][trace][#0:script/files.lua:275]: Set text:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/math.lua	takes	9.1000000000008e-05	sec.
[16:49:32.507][trace][#0:script/files.lua:674]: Compile State:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/math.lua
[16:49:32.515][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/math.lua	1
[16:49:32.515][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.515][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/math.lua , size = 9.017 KB
[16:49:32.516][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/math.lua	2
[16:49:32.516][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.516][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/string.lua , size = 6.396 KB
[16:49:32.516][trace][#0:script/files.lua:275]: Set text:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/string.lua	takes	9.5000000000012e-05	sec.
[16:49:32.516][trace][#0:script/files.lua:674]: Compile State:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/string.lua
[16:49:32.520][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/string.lua	1
[16:49:32.520][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.520][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/string.lua , size = 6.396 KB
[16:49:32.520][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/string.lua	2
[16:49:32.520][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.520][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/os.lua , size = 4.540 KB
[16:49:32.520][trace][#0:script/files.lua:275]: Set text:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/os.lua	takes	0.00010200000000002	sec.
[16:49:32.520][trace][#0:script/files.lua:674]: Compile State:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/os.lua
[16:49:32.523][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/os.lua	1
[16:49:32.523][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.523][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/os.lua , size = 4.540 KB
[16:49:32.523][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/os.lua	2
[16:49:32.523][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.523][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/table.lua , size = 4.320 KB
[16:49:32.523][trace][#0:script/files.lua:275]: Set text:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/table.lua	takes	9.3999999999983e-05	sec.
[16:49:32.523][trace][#0:script/files.lua:674]: Compile State:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/table.lua
[16:49:32.526][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/table.lua	1
[16:49:32.526][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.526][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/basic.lua , size = 14.540 KB
[16:49:32.526][trace][#0:script/files.lua:275]: Set text:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/basic.lua	takes	0.00010000000000002	sec.
[16:49:32.526][trace][#0:script/files.lua:674]: Compile State:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/basic.lua
[16:49:32.537][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/basic.lua	1
[16:49:32.537][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.537][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/table.lua , size = 4.320 KB
[16:49:32.537][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/table.lua	2
[16:49:32.537][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.537][debug][#0:script/workspace/loading.lua:97]: Preload file at: file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/basic.lua , size = 14.540 KB
[16:49:32.537][debug][#0:script/files.lua:435]: add ref	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8/basic.lua	2
[16:49:32.537][debug][#0:script/workspace/loading.lua:113]: ++++As library of:	file:///Users/user/.vscode/extensions/sumneko.lua-3.6.4-darwin-x64/server/meta/Lua%205.4%20en-us%20utf8
[16:49:32.640][info] [#0:script/workspace/loading.lua:169]: Loaded files takes [0.059] sec: <fallback>
[16:49:32.641][info] [#0:script/workspace/loading.lua:178]: Compile files takes [0.000] sec: <fallback>
[16:49:32.641][info] [#0:script/workspace/loading.lua:179]: Loaded finish:	<fallback>
[16:49:32.641][info] [#0:script/workspace/workspace.lua:349]: Preload finish at:	<fallback>
[16:49:32.644][debug][#0:script/vm/node.lua:460]: clearNodeCache
[16:49:32.645][debug][#0:script/provider/diagnostic.lua:639]: Refresh client diagnostics
[16:49:32.645][info] [#0:script/workspace/loading.lua:169]: Loaded files takes [0.063] sec: file:///Users/user/Desktop/Test
[16:49:32.645][info] [#0:script/workspace/loading.lua:178]: Compile files takes [0.000] sec: file:///Users/user/Desktop/Test
[16:49:32.645][info] [#0:script/workspace/loading.lua:179]: Loaded finish:	file:///Users/user/Desktop/Test
[16:49:32.645][info] [#0:script/workspace/workspace.lua:349]: Preload finish at:	file:///Users/user/Desktop/Test
[16:49:32.645][trace][#0:script/files.lua:674]: Compile State:	file:///Users/user/Desktop/Test/Test.lua
[16:49:32.659][debug][#0:script/vm/node.lua:460]: clearNodeCache
[16:49:32.659][debug][#0:script/provider/diagnostic.lua:639]: Refresh client diagnostics
[16:49:32.663][info] [#0:script/provider/diagnostic.lua:552]: Diagnostics scope [file:///Users/user/Desktop/Test], files count:[12]
[16:49:32.689][debug][#0:script/provider/diagnostic.lua:327]: publishDiagnostics	file:///Users/user/Desktop/Test/Test.lua	3
[16:49:32.689][info] [#0:script/provider/diagnostic.lua:569]: Diagnostics scope [file:///Users/user/Desktop/Test] finished, takes [0.023] sec.
[16:49:32.689][debug][#0:script/vm/node.lua:460]: clearNodeCache
@sumneko sumneko added the enhancement New feature or request label Jan 16, 2023
@firas-assaad
Copy link
Contributor

firas-assaad commented Jan 18, 2023

This should probably be broken into multiple separate issues with some overlap:

Exact type checking (all examples)

I'd like this too, but I'm not sure if the extension should check for missing fields by default, as that would probably require a lot of changes to existing code bases that use types in a more flexible way. This is particularly true for examples 4 to 6, where passing/returning arrays and non-annotated tables is allowed even if the function is annotated to accept/return specific types.

Perhaps a new annotation when defining classes like my suggestion here #1602

Alternatively (or in addition), a new annotation could be introduced to do the checking when using the type (e.g. @return exact Test, @type exact Test or a better syntax).

Generic table.insert (example 4 and 6)

This seems like a more generic problem with the definition of table.insert taking an ordinary table. Even if list was explicitly typed as Test[], the issue is still there and you can even insert a number or a string.

Type of return statement (example 5)

There's no way to specify the type of a table returned by a return statement other than creating a typed local variable. It's also weird that even basic checking for invalid type isn't done in this case. I think a fix for this would be good even if the other examples with exact types aren't implemented. It also comes up with modules: #1656

@lukasbestle
Copy link
Author

Thanks for looking into it. 💛

Perhaps a new annotation when defining classes like my suggestion here #1602

Alternatively (or in addition), a new annotation could be introduced to do the checking when using the type (e.g. @return exact Test, @type exact Test or a better syntax).

I agree, both the annotation for final/exact classes and the annotation for exact return values make a lot of sense. Treating classes as final by default would indeed be a huge breaking change that should be avoided. But to be honest I was very surprised when I saw that invalid or missing fields are not checked with the current implementation.

This seems like a more generic problem with the definition of table.insert taking an ordinary table. Even if list was explicitly typed as Test[], the issue is still there and you can even insert a number or a string.

You are right, that seems to be the case. Now it makes sense to me why these examples don't work.

What I would expect is that lua-language-server traces back the annotated type to all places where the variable is modified. After all, that's also what happens when I declare more simple param types.

So if I say that a method takes an array of a particular type, I'd expect that the passed variable is internally marked to be that. Then everything that gets added to the table must be of the declared type.

There's no way to specify the type of a table returned by a return statement other than creating a typed local variable.

Do I understand you correctly that the type of a @return annotation is completely ignored at the moment?

Similar to param types, I'd expect lua-language-server to trace the type back from the return statement.

@firas-assaad
Copy link
Contributor

firas-assaad commented Jan 21, 2023

So if I say that a method takes an array of a particular type, I'd expect that the passed variable is internally marked to be that. Then everything that gets added to the table must be of the declared type.

I'm not familiar with the internals of the extension or how it traces variable types. My experience is that it usually works forward from annotations, and not backwards. What you propose does makes sense, if it's possible.

Do I understand you correctly that the type of a @return annotation is completely ignored at the moment?

It's not ignored. The basic type is checked (e.g. returning a number when you used @return table), but if you want to return a class type or string[] array for example, any plain table will be accepted as a valid return value and no checking is done.

Since there's no way to explicitly specify the type of a directly returned table (return { ... }), I usually have to work around that by explicitly annotating the type of a local variable before returning it. Type checking does work in that case, and it won't let you return a Foo local variable when the function annotation expects a Bar return value.

@LunNova
Copy link

LunNova commented Mar 4, 2024

You can add (exact) classes being treated as having a __call metamethod even when one isn't defined to the list of odd behaviors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants