LuaLS / LuaLS/lua-language-server

Wrong language when initialize server

Ouverte
#2,296 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Lua
Étoiles
4.4k
Forks
442
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez dans language.lua et examinez le code de correspondance des locales ainsi que les valeurs de supportLanguage indiquées dans l’issue. Reproduisez la configuration de Neovim avec la locale zh_TW, puis vérifiez que la langue résolue est zh-tw plutôt que zh-cn et que les locales déjà prises en charge sont toujours résolues correctement.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
lua
Domaine
localization
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.