Closed istudyatuni closed 6 months ago
The latest version of LSP-typescript (or rather the underlaying server) might be more strict about that. I guess the older versions might not have complained about that but then some behavior would likely not have been correct.
You can open this configuration file:
and map source.js.vite
to javascript
(basing this on https://github.com/SublimeText/AFileIcon/blob/master/preferences/file_type_vite.tmPreferences).
I don't have generic solution for what "A File Icon " does though.
With latest version of LSP this should now work without custom changes to mapping overrides.
I have installed packages (tested in safe mode):
"A File Icon" uses custom syntax scopes for icons, as per their readme:
so this packages creates syntax named "JavaScript (Vite)" for
vite.config.js
. Probably, because of this, requests to language server failed with messageRequest textDocument/documentHighlight failed with message: The document should be opened first: file:///tmp/test-vite/vite.config.js'
Logs
```js :: [19:50:18.414] -> LSP-typescript textDocument/didOpen: {'textDocument': {'text': "import path from 'path'\n", 'version': 0, 'uri': 'file:///tmp/test-vite/vite.config.js', 'languageId': 'vite'}} LSP-typescript: Notification handler 'textDocument/didOpen' failed with message: Cannot open document 'file:///tmp/test-vite/vite.config.js'. :: [19:50:18.417] --> LSP-typescript textDocument/codeLens (2): {'textDocument': {'uri': 'file:///tmp/test-vite/vite.config.js'}} LSP-typescript: Unexpected resource file:///tmp/test-vite/vite.config.js :: [19:50:18.424] <- LSP-typescript window/logMessage: {'message': "Notification handler 'textDocument/didOpen' failed with message: Cannot open document 'file:///tmp/test-vite/vite.config.js'.", 'type': 1} :: [19:50:18.424] <- LSP-typescript window/logMessage: {'message': 'Unexpected resource file:///tmp/test-vite/vite.config.js', 'type': 1} :: [19:50:18.424] <<< LSP-typescript (2) (duration: 6ms): [] :: [19:50:31.393] --> LSP-typescript textDocument/documentHighlight (3): {'position': {'line': 0, 'character': 9}, 'textDocument': {'uri': 'file:///tmp/test-vite/vite.config.js'}} :: [19:50:31.398] --> LSP-typescript textDocument/codeAction (4): {'textDocument': {'uri': 'file:///tmp/test-vite/vite.config.js'}, 'range': {'start': {'line': 0, 'character': 9}, 'end': {'line': 0, 'character': 9}}, 'context': {'triggerKind': 2, 'diagnostics': []}} LSP-typescript: Unexpected resource file:///tmp/test-vite/vite.config.js :: [19:50:31.400] <- LSP-typescript window/logMessage: {'message': 'Unexpected resource file:///tmp/test-vite/vite.config.js', 'type': 1} :: [19:50:31.400] <~~ LSP-typescript (3) (duration: 6ms): {'message': 'Request textDocument/documentHighlight failed with message: The document should be opened first: file:///tmp/test-vite/vite.config.js', 'code': -32603} LSP-typescript: Unexpected resource file:///tmp/test-vite/vite.config.js :: [19:50:31.402] <- LSP-typescript window/logMessage: {'message': 'Unexpected resource file:///tmp/test-vite/vite.config.js', 'type': 1} :: [19:50:31.402] <<< LSP-typescript (4) (duration: 4ms): [] ```
I redacted $HOME
Troubleshoot info
# Troubleshooting: LSP-typescript ## Version - LSP: 1.26.0 - Sublime Text: 4152 ## Server Test Run - exit code: 0 - output ``` ``` ## Server Configuration - command ```json [ "${node_bin}", "${server_path}", "--stdio" ] ``` - shell command ```sh $HOME/.nvm/versions/node/v16.15.1/bin/node "$HOME/.cache/sublime-text-safe-mode/Package Storage/LSP-typescript/16.15.1/typescript-language-server/node_modules/typescript-language-server/lib/cli.mjs" --stdio ``` - selector ``` source.js, source.jsx, source.ts, source.tsx ``` - priority_selector ``` source.js, source.jsx, source.ts, source.tsx ``` - init_options ```json { "completionDisableFilterText": true, "disableAutomaticTypingAcquisition": false, "locale": "en", "maxTsServerMemory": 0, "npmLocation": "", "plugins": [], "preferences": { "allowIncompleteCompletions": true, "allowRenameOfImportPath": true, "allowTextChangesInNewFiles": true, "autoImportFileExcludePatterns": [], "disableSuggestions": false, "displayPartsForJSDoc": true, "generateReturnInDocTemplate": true, "importModuleSpecifierEnding": "auto", "importModuleSpecifierPreference": "shortest", "includeAutomaticOptionalChainCompletions": true, "includeCompletionsForImportStatements": true, "includeCompletionsForModuleExports": true, "includeCompletionsWithClassMemberSnippets": true, "includeCompletionsWithInsertText": true, "includeCompletionsWithObjectLiteralMethodSnippets": true, "includeCompletionsWithSnippetText": true, "includePackageJsonAutoImports": "auto", "interactiveInlayHints": true, "jsxAttributeCompletionStyle": "auto", "lazyConfiguredProjectsFromExternalProject": false, "organizeImportsAccentCollation": true, "organizeImportsCaseFirst": false, "organizeImportsCollation": "ordinal", "organizeImportsCollationLocale": "en", "organizeImportsIgnoreCase": "auto", "organizeImportsNumericCollation": false, "providePrefixAndSuffixTextForRename": true, "provideRefactorNotApplicableReason": true, "quotePreference": "auto", "useLabelDetailsInCompletionEntries": true }, "tsserver": { "logDirectory": "", "logVerbosity": "off", "path": "", "trace": "off", "useSyntaxServer": "auto" } } ``` - settings ```json { "diagnostics": { "ignoredCodes": [] }, "implicitProjectConfiguration": { "checkJs": false, "experimentalDecorators": false, "module": "ESNext", "strictFunctionTypes": true, "strictNullChecks": true, "target": "ES2020" }, "javascript": { "format": { "insertSpaceAfterCommaDelimiter": true, "insertSpaceAfterConstructor": false, "insertSpaceAfterFunctionKeywordForAnonymousFunctions": true, "insertSpaceAfterKeywordsInControlFlowStatements": true, "insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false, "insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false, "insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true, "insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false, "insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false, "insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false, "insertSpaceAfterSemicolonInForStatements": true, "insertSpaceAfterTypeAssertion": false, "insertSpaceBeforeAndAfterBinaryOperators": true, "insertSpaceBeforeFunctionParenthesis": false, "insertSpaceBeforeTypeAnnotation": false, "placeOpenBraceOnNewLineForControlBlocks": false, "placeOpenBraceOnNewLineForFunctions": false, "semicolons": "ignore", "trimTrailingWhitespace": true }, "implementationsCodeLens": { "enabled": false }, "inlayHints": { "includeInlayEnumMemberValueHints": false, "includeInlayFunctionLikeReturnTypeHints": false, "includeInlayFunctionParameterTypeHints": false, "includeInlayParameterNameHints": "none", "includeInlayParameterNameHintsWhenArgumentMatchesName": false, "includeInlayPropertyDeclarationTypeHints": false, "includeInlayVariableTypeHints": false, "includeInlayVariableTypeHintsWhenTypeMatchesName": false }, "referencesCodeLens": { "enabled": false, "showOnAllFunctions": false } }, "statusText": "$version, $source", "typescript": { "format": { "insertSpaceAfterCommaDelimiter": true, "insertSpaceAfterConstructor": false, "insertSpaceAfterFunctionKeywordForAnonymousFunctions": true, "insertSpaceAfterKeywordsInControlFlowStatements": true, "insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false, "insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false, "insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true, "insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false, "insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false, "insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false, "insertSpaceAfterSemicolonInForStatements": true, "insertSpaceAfterTypeAssertion": false, "insertSpaceBeforeAndAfterBinaryOperators": true, "insertSpaceBeforeFunctionParenthesis": false, "insertSpaceBeforeTypeAnnotation": false, "placeOpenBraceOnNewLineForControlBlocks": false, "placeOpenBraceOnNewLineForFunctions": false, "semicolons": "ignore", "trimTrailingWhitespace": true }, "implementationsCodeLens": { "enabled": false }, "inlayHints": { "includeInlayEnumMemberValueHints": false, "includeInlayFunctionLikeReturnTypeHints": false, "includeInlayFunctionParameterTypeHints": false, "includeInlayParameterNameHints": "none", "includeInlayParameterNameHintsWhenArgumentMatchesName": false, "includeInlayPropertyDeclarationTypeHints": false, "includeInlayVariableTypeHints": false, "includeInlayVariableTypeHintsWhenTypeMatchesName": false }, "referencesCodeLens": { "enabled": false, "showOnAllFunctions": false } } } ``` - env ```json { "PATH": "$HOME/.nvm/versions/node/v16.15.1/bin:$HOME/.nvm/versions/node/v16.15.1/bin:$HOME/.nvm/versions/node/v16.15.1/bin:" } ``` ## Active view - File name ``` /tmp/test-vite/vite.config.js ``` - Settings ```json { "auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc", "lsp_active": true, "syntax": "Packages/zzz A File Icon zzz/aliases/JavaScript (Vite).sublime-syntax" } ``` - base scope ``` source.js.vite ``` ## Project / Workspace - folders ```json [ "/tmp/test-vite" ] ``` - is project: False ## LSP configuration \
## System PATH
- $HOME/.pyenv/shims
- $HOME/.nvm/versions/node/v16.15.1/bin
- $HOME/.ghcup/bin
- $HOME/.nix-profile/bin
- /nix/var/nix/profiles/default/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/bin
- /opt/android-sdk/emulator
- /opt/cuda/bin
- /opt/cuda/nsight_compute
- /opt/cuda/nsight_systems/bin
- $HOME/.dotnet/tools
- /var/lib/flatpak/exports/bin
- /usr/lib/jvm/default/bin
- /usr/bin/site_perl
- /usr/bin/vendor_perl
- /usr/bin/core_perl
- /usr/lib/rustup/bin
- $HOME/.local/bin
- $HOME/.applications
- $HOME/.go/bin
- $HOME/.cargo/bin
- $HOME/.nix-profile/bin
- $HOME/.yarn/bin