LuaLS / LuaLS/lua-language-server

Wrong language when initialize server

Aperta
#2,296 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Lua
Stelle
4.4k
Fork
442
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

How are you using the lua-language-server?

NeoVim

Which OS are you using?

MacOS

What is the issue affecting?

Diagnostics/Syntax Checking

Expected Behaviour

Correct language zh-tw

Actual Behaviour

Wrong language zh-cn

Reproduction steps
  1. Install coc-lua and lua-language-server
  2. Open lua file using neovim
  3. Got warning and suggestion by language server in zh-cn language
Additional Notes

I found in the log below that the language is set to locale = zh_TW, and it's being matched using only the first two characters against the supportLanguage list (['zh-cn', 'zh-tw', 'pt-br', 'en-us']) with the following code in language.lua:

    for _, lang in ipairs(support) do
        if lang:sub(1, 2) == id:sub(1, 2) then
            return lang
        end
    end

As a result, the lang will become zh-cn. Is this because my locale should be correctly set to lowercase (zh-tw), or should we check both uppercase locale (zh_TW) and lowercase locale(zh-tw)?"

If this issue is a result of my misconfiguration, kindly inform me of the steps needed to rectify the locale settings.

Log File

log/service.log

[15:59:22.012][info] [#0:/Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server/main.lua:66]: Lua Lsp startup, root:       /Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server
[15:59:22.012][info] [#0:/Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server/main.lua:67]: ROOT:        /Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server
[15:59:22.012][info] [#0:/Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server/main.lua:68]: LOGPATH:     /Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server/log
[15:59:22.012][info] [#0:/Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server/main.lua:69]: METAPATH:    /Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server/meta
[15:59:22.013][info] [#0:/Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server/main.lua:70]: VERSION:     3.7.0
[15:59:22.028][info] [#0:script/pub/pub.lua:81]: Push task to braves: "loadProtoByStdio" => 1
[15:59:22.028][info] [#0:script/pub/pub.lua:82]: nil
[15:59:22.028][info] [#0:script/service/service.lua:144]:
========= Medical Examination Report =========
    --------------- Memory ---------------
        Total: 2.141 MB
        # 00 : 2.141 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
==============================================
[15:59:22.028][info] [#0:script/pub/pub.lua:81]: Push task to braves: "removeCaches" => 2
[15:59:22.028][info] [#0:script/pub/pub.lua:82]: /Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server/log/cache
[15:59:22.030][info] [#0:script/pub/pub.lua:81]: Push task to braves: "timer" => 3
[15:59:22.030][info] [#0:script/pub/pub.lua:82]: 1
[15:59:22.030][info] [#0:script/pub/pub.lua:114]: Brave pushed report: # 1 => "mem"
[15:59:22.030][info] [#0:script/pub/pub.lua:115]: 52.1845703125
[15:59:22.030][info] [#0:script/pub/pub.lua:114]: Brave pushed report: # 3 => "mem"
[15:59:22.030][info] [#0:script/pub/pub.lua:115]: 52.1845703125
[15:59:22.030][info] [#0:script/pub/pub.lua:114]: Brave pushed report: # 2 => "mem"
[15:59:22.030][info] [#0:script/pub/pub.lua:115]: 52.1845703125
[15:59:22.030][info] [#0:script/pub/pub.lua:114]: Brave pushed report: # 4 => "mem"
[15:59:22.030][info] [#0:script/pub/pub.lua:115]: 52.1845703125
[15:59:22.030][info] [#0:script/pub/pub.lua:97]: Brave pushed task: # 3 => 2
[15:59:22.030][info] [#0:script/pub/pub.lua:114]: Brave pushed report: # 3 => "mem"
[15:59:22.030][info] [#0:script/pub/pub.lua:115]: 82.0244140625
[15:59:22.030][info] [#0:script/pub/pub.lua:114]: Brave pushed report: # 1 => "proto"
[15:59:22.031][info] [#0:script/pub/pub.lua:115]: {
  id = 0,
  jsonrpc = "2.0",
  method = "initialize",
  params = {
    capabilities = {
      general = {
        markdown = {
          parser = "marked",
          version = "4.0.10"
        },
        positionEncodings = { "utf-16" },
        regularExpressions = {
          engine = "ECMAScript",
          version = "ES2020"
        },
        staleRequestSupport = {
          cancel = true,
          retryOnContentModified = { "textDocument/inlayHint", "textDocument/semanticTokens/full", "textDocument/semanticTokens/range", "textDocument/semanticTokens/full/delta" }
        }
      },
      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 = true
        },
        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 = true
        },
        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", "decorator", "operator" }
        },
        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 = false
          },
          documentChanges = true,
          failureHandling = "undo",
          normalizesLineEndings = true,
          resourceOperations = { "create", "rename", "delete" }
        },
        workspaceFolders = true
      }
    },
    clientInfo = {
      name = "coc.nvim",
      version = "0.0.82"
    },
    initializationOptions = {
      changeConfiguration = true
    },
    locale = "zh_TW",
    processId = 91771,
    rootPath = "/Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server",
    rootUri = "file:///Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server",
    trace = "off",
    workDoneToken = "3766df03-cd95-471b-95f6-7fe7e70cf5ab",
    workspaceFolders = { {
        name = "lua-language-server",
        uri = "file:///Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server"
      } }
  }
}
[15:59:22.031][info] [#0:script/client.lua:657]: Client init    {
  capabilities = {
    general = {
      markdown = {
        parser = "marked",
        version = "4.0.10"
      },
      positionEncodings = { "utf-16" },
      regularExpressions = {
        engine = "ECMAScript",
        version = "ES2020"
      },
      staleRequestSupport = {
        cancel = true,
        retryOnContentModified = { "textDocument/inlayHint", "textDocument/semanticTokens/full", "textDocument/semanticTokens/range", "textDocument/semanticTokens/full/delta" }
      }
    },
    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 = true
      },
      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 = true
      },
      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", "decorator", "operator" }
      },
      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 = false
        },
        documentChanges = true,
        failureHandling = "undo",
        normalizesLineEndings = true,
        resourceOperations = { "create", "rename", "delete" }
      },
      workspaceFolders = true
    }
  },
  clientInfo = {
    name = "coc.nvim",
    version = "0.0.82"
  },
  initializationOptions = {
    changeConfiguration = true
  },
  locale = "zh_TW",
  processId = 91771,
  rootPath = "/Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server",
  rootUri = "file:///Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server",
  trace = "off",
  workDoneToken = "3766df03-cd95-471b-95f6-7fe7e70cf5ab",
  workspaceFolders = { {
      name = "lua-language-server",
      uri = "file:///Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server"
    } }
}
[15:59:22.031][info] [#0:script/language.lua:137]: VSC language: zh_TW
[15:59:22.031][info] [#0:script/language.lua:138]: LS  language: zh-cn
[15:59:22.031][info] [#0:script/workspace/workspace.lua:38]: Workspace init root:       file:///Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server
[15:59:22.031][info] [#0:script/workspace/workspace.lua:42]: Log path:  /Users/iver/.config/coc/extensions/coc-lua-data/lua-language-server/log/file_Users_iver_.config_coc_extensions_coc-lua-data_lua-language-server.log

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia in language.lua e ispeziona il codice di corrispondenza delle locale e i valori di supportLanguage elencati nell’issue. Riproduci la configurazione di Neovim con la locale zh_TW, quindi verifica che la lingua risolta sia zh-tw invece di zh-cn e che le locale già supportate continuino a essere risolte correttamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
lua
Ambito
localization
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.