LuaLS / LuaLS/lua-language-server

Wrong language when initialize server

Abierto
#2,296 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Lua
Estrellas
4.4k
Forks
442
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza en language.lua e inspecciona el código de coincidencia de locales y los valores de supportLanguage indicados en el issue. Reproduce la configuración de Neovim con la locale zh_TW y verifica que el idioma resuelto sea zh-tw en lugar de zh-cn y que las locales compatibles existentes sigan resolviéndose correctamente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
lua
Área
localization
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.