LSP-typescript icon indicating copy to clipboard operation
LSP-typescript copied to clipboard

Goto Type Definition not work with eslint-plugin-perfectionist.

Open rgant opened this issue 11 months ago • 3 comments

I am unable to "Goto Type Definition..." or "Goto Definition..." on eslint-plugin-perfectionist. It works for @eslint/js, globals, and typescript-eslint in eslint.config.mjs.

Minimal reproduction repo: https://github.com/rgant/tmp-eslint-perfectionist-test

Trouble Shoot Server Output

Troubleshooting: LSP-typescript

Version

  • LSP: 2.3.0
  • Sublime Text: 4189

Server Test Run

  • exit code: 0
  • output

Server Configuration

  • command
[
  "${node_bin}",
  "${server_path}",
  "--stdio"
]
  • shell command
/Users/rgant/.nvm/versions/node/v22.12.0/bin/node "/Users/rgant/Library/Caches/Sublime Text 3/Package Storage/LSP-typescript/22.12.0/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
{
  "completionDisableFilterText": true,
  "disableAutomaticTypingAcquisition": false,
  "locale": "en",
  "maxTsServerMemory": 0,
  "npmLocation": "",
  "plugins": [],
  "preferences": {
    "allowIncompleteCompletions": true,
    "allowRenameOfImportPath": true,
    "allowTextChangesInNewFiles": true,
    "autoImportFileExcludePatterns": [],
    "disableSuggestions": false,
    "displayPartsForJSDoc": true,
    "excludeLibrarySymbolsInNavTo": 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": {
    "fallbackPath": "",
    "logDirectory": "",
    "logVerbosity": "off",
    "path": "",
    "trace": "off",
    "useSyntaxServer": "auto"
  }
}
  • settings
{
  "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
{
  "PATH": "/Users/rgant/.nvm/versions/node/v22.12.0/bin:"
}

Active view

  • File name
/Users/rgant/Programming/tmp-eslint-perfectionist-test/eslint.config.mjs
  • Settings
{
  "auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc",
  "lsp_active": true,
  "syntax": "Packages/JavaScript/JavaScript.sublime-syntax"
}
  • base scope
source.js

Project / Workspace

  • folders
[
  "/Users/rgant/Programming/tmp-eslint-perfectionist-test"
]
  • is project: False

LSP configuration

{
  "show_diagnostics_panel_on_save": 4
}

System PATH

  • /opt/homebrew/share/google-cloud-sdk/bin
  • /Users/rgant/.pyenv/shims
  • /Users/rgant/.nvm/versions/node/v22.12.0/bin
  • /opt/homebrew/bin
  • /opt/homebrew/sbin
  • /Users/rgant/bin
  • /Users/rgant/.local/bin
  • /opt/homebrew/opt/libpq/bin
  • /Users/rgant/go/bin
  • /usr/local/bin
  • /System/Cryptexes/App/usr/bin
  • /usr/bin
  • /bin
  • /usr/sbin
  • /sbin
  • /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin
  • /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin
  • /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
  • /Library/Apple/usr/bin
  • /Library/Frameworks/Mono.framework/Versions/Current/Commands
  • .

I originally found this issue in a new Angular project and opened this ticket with the plugin developers. They have been very helpful in looking into this issue, but believe it is outside of their code. I created the above brand new repo to try and replicate the bug. But I was not able to get the same error message. However the code discovery actions are not working so it feel like there is something here to diagnose. But I am uncertain how to proceed.

rgant avatar Jan 12 '25 15:01 rgant

The error message I get with the angular project is of the form:

Cannot find module * or its corresponding type declarations. typescript(2307) There are types at *, but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

Screenshot 2025-01-11 at 08 22 34

I do not see this error with the minimal reproduction, but I assume it is related.

rgant avatar Jan 12 '25 15:01 rgant

Hello, Looks like the https://github.com/typescript-language-server/typescript-language-server returns a empty response, but only when doing a goto definition on this line:

import perfectionist from "eslint-plugin-perfectionist";
                                              ^ goto def here

https://github.com/rgant/tmp-eslint-perfectionist-test/blob/6b8b429ebe1eb5045e93eca632a16cb652d59914/eslint.config.mjs#L2

I have tested VS Code, and goto definition works there. I also tested a different language server vtsls and goto definition works there also.

The issue should ideally be reported to https://github.com/typescript-language-server/typescript-language-server/issues

predragnikolic avatar Jan 12 '25 19:01 predragnikolic

Thank you, I have opened a ticket there.

rgant avatar Jan 12 '25 20:01 rgant

Was fixed upstream.

rchl avatar Oct 06 '25 13:10 rchl