-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: hover dialog is only triggered by an area one pixel wide #323
Comments
This really is strange. I've investigated and it looks like VS Code's behaviour is inconsistent: even though we pass it a single position and it correctly displays the underlined error in the view, it doesn't treat the hover location the same way. So since the position is one and the same, it expects the user to hover over that exact one-pixel spot even though the underline spans the full character. We can work around this by sending a position that ends on the next character, which still displays it as a single-character problem but allows the hover region to be the full character. I'll push up a fix shortly; it will probably make it into 1.2. |
Fixes #323 Adjusts diagnostic creation to send [start, end) ranges instead of [start, end]. Works around VS Code's inconsistent behaviour in which problems that are displayed for a single character may have a smaller hover region than the underline visual.
Fixes #323 Adjusts diagnostic creation to send [start, end) ranges instead of [start, end]. Works around VS Code's inconsistent behaviour in which problems that are displayed for a single character may have a smaller hover region than the underline visual.
Done in #325. Will land in 1.2.0. |
Thanks! |
How did you encounter this bug?
When I write CSS that triggers a style lint warning, the warning shows up correctly in the problems panel and if I run stylelint from the command line, but I can only trigger the hover dialog on the line of code itself by carefully moving my mouse pointer pixel by pixel horizontally. Only one pixel triggers the hover dialog; a pixel either side does not.
Code Snippet
No response
Extension Configuration
No response
Actual Behaviour
As above.
Expected Behaviour
I understand that you can only show a single character at present because of limitations in the information you get from stylelint. However I expected to be able to hover over the entire single character to trigger the hover dialog, not just a single pixel.
Logs
[Info - 00:39:13] [language-server] Registering module | module: "auto-fix"
[Info - 00:39:13] [language-server] Module registered | module: "auto-fix"
[Info - 00:39:13] [language-server] Registering module | module: "code-action"
[Info - 00:39:13] [language-server] Module registered | module: "code-action"
[Info - 00:39:13] [language-server] Registering module | module: "completion"
[Info - 00:39:13] [language-server] Module registered | module: "completion"
[Info - 00:39:13] [language-server] Registering module | module: "formatter"
[Info - 00:39:13] [language-server] Module registered | module: "formatter"
[Info - 00:39:13] [language-server] Registering module | module: "old-stylelint-warning"
[Info - 00:39:13] [language-server] Module registered | module: "old-stylelint-warning"
[Info - 00:39:13] [language-server] Registering module | module: "validator"
[Info - 00:39:13] [language-server] Module registered | module: "validator"
[Info - 00:39:13] [language-server] Starting language server
[Info - 00:39:13] [language-server] Registering handlers
[Debug - 12:39:13 a.m.] [language-server] onInitialize handler registered
[Debug - 12:39:13 a.m.] [language-server] onDidChangeConfiguration handler registered
[Debug - 12:39:13 a.m.] [language-server] Invoking onDidRegisterHandlers
[Debug - 12:39:13 a.m.] [language-server:auto-fix] Registering onExecuteCommand handler
[Debug - 12:39:13 a.m.] [language-server:auto-fix] onExecuteCommand handler registered
[Debug - 12:39:13 a.m.] [language-server] Invoked onDidRegisterHandlers | module: "auto-fix" returnValue: undefined
[Debug - 12:39:13 a.m.] [language-server:code-action] Registering onCodeAction handler
[Debug - 12:39:13 a.m.] [language-server:code-action] onCodeAction handler registered
[Debug - 12:39:13 a.m.] [language-server] Invoked onDidRegisterHandlers | module: "code-action" returnValue: undefined
[Debug - 12:39:13 a.m.] [language-server:completion] Registering onCompletion handler
[Debug - 12:39:13 a.m.] [language-server:completion] onCompletion handler registered
[Debug - 12:39:13 a.m.] [language-server] Invoked onDidRegisterHandlers | module: "completion" returnValue: undefined
[Debug - 12:39:13 a.m.] [language-server:formatter] Registering onDocumentFormatting handler
[Debug - 12:39:13 a.m.] [language-server:formatter] onDocumentFormatting handler registered
[Debug - 12:39:13 a.m.] [language-server] Invoked onDidRegisterHandlers | module: "formatter" returnValue: undefined
[Debug - 12:39:13 a.m.] [language-server:old-stylelint-warning] Registering onDidOpen handler
[Debug - 12:39:13 a.m.] [language-server:old-stylelint-warning] onDidOpen handler registered
[Debug - 12:39:13 a.m.] [language-server] Invoked onDidRegisterHandlers | module: "old-stylelint-warning" returnValue: undefined
[Debug - 12:39:13 a.m.] [language-server:validator] Registering handlers
[Debug - 12:39:13 a.m.] [language-server:validator] onDidChangeWatchedFiles handler registered
[Debug - 12:39:13 a.m.] [language-server:validator] onDidChangeContent handler registered
[Debug - 12:39:13 a.m.] [language-server:validator] onDidClose handler registered
[Debug - 12:39:13 a.m.] [language-server:validator] Handlers registered
[Debug - 12:39:13 a.m.] [language-server] Invoked onDidRegisterHandlers | module: "validator" returnValue: undefined
[Info - 00:39:13] [language-server] Handlers registered
[Info - 00:39:13] [language-server] Language server started
[Debug - 12:39:13 a.m.] [language-server] received onInitialize | params: {"processId":72277,"clientInfo":{"name":"Visual Studio Code","version":"1.62.2"},"locale":"en-gb","rootPath":"/Users/redacted/Documents/Projects/redacted","rootUri":"file:///Users/redacted/Documents/Projects/redacted","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":true}},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":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]}},"codeLens":{"refreshSupport":true},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true,"semanticTokens":{"refreshSupport":true},"fileOperations":{"dynamicRegistration":true,"didCreate":true,"didRename":true,"didDelete":true,"willCreate":true,"willRename":true,"willDelete":true}},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]},"codeDescriptionSupport":true,"dataSupport":true},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]},"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"insertTextModeSupport":{"valueSet":[1,2]}},"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]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true},"activeParameterSupport":true},"contextSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":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]},"hierarchicalDocumentSymbolSupport":true,"tagSupport":{"valueSet":[1]},"labelSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupport":true,"disabledSupport":true,"dataSupport":true,"resolveSupport":{"properties":["edit"]},"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"honorsChangeAnnotations":false},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1,"honorsChangeAnnotations":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"declaration":{"dynamicRegistration":true,"linkSupport":true},"selectionRange":{"dynamicRegistration":true},"callHierarchy":{"dynamicRegistration":true},"semanticTokens":{"dynamicRegistration":true,"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"],"requests":{"range":true,"full":{"delta":true}},"multilineTokenSupport":false,"overlappingTokenSupport":false},"linkedEditingRange":{"dynamicRegistration":true}},"window":{"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"showDocument":{"support":true},"workDoneProgress":true},"general":{"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"markdown":{"parser":"marked","version":"1.1.0"}}},"trace":"off","workspaceFolders":[{"uri":"file:///Users/redacted/Documents/Projects/redacted","name":"redacted"}]}
[Debug - 12:39:13 a.m.] [language-server] Invoking onInitialize
[Debug - 12:39:13 a.m.] [language-server] Invoked onInitialize | module: "auto-fix" returnValue: {"capabilities":{"executeCommandProvider":{"commands":["stylelint.applyAutoFix"]}}}
[Debug - 12:39:13 a.m.] [language-server] Invoked onInitialize | module: "code-action" returnValue: {"capabilities":{"codeActionProvider":{"codeActionKinds":["quickfix","source.fixAll.stylelint"]}}}
[Debug - 12:39:13 a.m.] [language-server] Invoked onInitialize | module: "completion" returnValue: {"capabilities":{"completionProvider":{}}}
[Debug - 12:39:13 a.m.] [language-server] Invoked onInitialize | module: "formatter" returnValue: {"capabilities":{"documentFormattingProvider":false}}
[Debug - 12:39:13 a.m.] [language-server] Invoked onInitialize | module: "old-stylelint-warning" returnValue: undefined
[Debug - 12:39:13 a.m.] [language-server] Invoked onInitialize | module: "validator" returnValue: undefined
[Debug - 12:39:13 a.m.] [language-server] Returning initialization results | result: {"capabilities":{"textDocumentSync":{"openClose":true,"change":1},"executeCommandProvider":{"commands":["stylelint.applyAutoFix"]},"codeActionProvider":{"codeActionKinds":["quickfix","source.fixAll.stylelint"]},"completionProvider":{},"documentFormattingProvider":false}}
[Debug - 12:39:13 a.m.] [language-server] received onDidChangeConfiguration | params: {"settings":{"stylelint":{"enable":true,"config":null,"configFile":"","configBasedir":"","customSyntax":"","ignoreDisables":false,"reportNeedlessDisables":false,"reportInvalidScopeDisables":false,"stylelintPath":"","packageManager":"npm","validate":["css","less","postcss"],"snippet":["css","less","postcss"]}}}
[Debug - 12:39:13 a.m.] [language-server] Options updated | options: {"config":null,"configBasedir":"","configFile":"","customSyntax":"","ignoreDisables":false,"packageManager":"npm","reportInvalidScopeDisables":false,"reportNeedlessDisables":false,"snippet":["css","less","postcss"],"stylelintPath":"","validate":["css","less","postcss"]}
[Debug - 12:39:13 a.m.] [language-server] Languages that should be validated changed | languages: ["css","less","postcss"] removedLanguages: []
[Debug - 12:39:13 a.m.] [language-server] Invoking onDidChangeValidateLanguages
[Debug - 12:39:13 a.m.] [language-server:formatter] Received onDidChangeValidateLanguages | languages: ["css","less","postcss"]
[Debug - 12:39:13 a.m.] [language-server:formatter] Registering formatter for languages | languages: ["css","less","postcss"]
[Debug - 12:39:13 a.m.] [language-server] Invoked onDidChangeValidateLanguages | module: "formatter" returnValue: {}
[Debug - 12:39:13 a.m.] [language-server:validator] Received onDidChangeValidateLanguages | removedLanguages: []
[Debug - 12:39:13 a.m.] [language-server] Invoked onDidChangeValidateLanguages | module: "validator" returnValue: undefined
[Debug - 12:39:13 a.m.] [language-server] Invoking onDidChangeConfiguration
[Debug - 12:39:13 a.m.] [language-server:validator] Received onDidChangeConfiguration
[Debug - 12:39:13 a.m.] [language-server] Invoked onDidChangeConfiguration | module: "validator" returnValue: {}
[Debug - 12:39:13 a.m.] [language-server] Linting document | uri: "file:///Users/redacted/Documents/Projects/redacted/src/App.module.css" linterOptions: {}
[Debug - 12:39:13 a.m.] [language-server:code-action] Received onCodeAction | uri: "file:///Users/redacted/Documents/Projects/redacted/src/App.module.css" context: {"diagnostics":[]}
[Debug - 12:39:13 a.m.] [language-server:code-action] Unsupported code action kind, ignoring | kind: undefined
[Debug - 12:39:13 a.m.] [language-server:formatter] Formatter registered
[Debug - 12:39:13 a.m.] [language-server] Resolving Stylelint | uri: "file:///Users/redacted/Documents/Projects/redacted/src/App.module.css"
[Debug - 12:39:13 a.m.] [language-server] npm returned global node_modules path. | path: "/Users/redacted/.nvm/versions/node/v16.13.0/lib/node_modules"
[Debug - 12:39:13 a.m.] [language-server] npm returned global node_modules path. | path: "/Users/redacted/.nvm/versions/node/v16.13.0/lib/node_modules"
[Debug - 12:39:13 a.m.] [language-server] Could not find a Yarn lockfile | cwd: "/Users/redacted/Documents/Projects/redacted/src"
[Debug - 12:39:13 a.m.] [language-server] NODE_PATH value is: /Users/redacted/.nvm/versions/node/v16.13.0/lib/node_modules | verbose: undefined
[Debug - 12:39:13 a.m.] [language-server] Could not find a Yarn lockfile | cwd: "/Users/redacted/Documents/Projects/redacted/src"
[Debug - 12:39:13 a.m.] [language-server] NODE_PATH value is: /Users/redacted/.nvm/versions/node/v16.13.0/lib/node_modules | verbose: undefined
[Debug - 12:39:13 a.m.] [language-server] Resolved Stylelint from node_modules | path: "/Users/redacted/Documents/Projects/redacted/node_modules/stylelint/lib/index.js"
[Debug - 12:39:13 a.m.] [language-server] Stylelint resolved | uri: "file:///Users/redacted/Documents/Projects/redacted/src/App.module.css" resolvedPath: "/Users/redacted/Documents/Projects/redacted/node_modules/stylelint/lib/index.js"
[Debug - 12:39:13 a.m.] [language-server] Resolved Stylelint from node_modules | path: "/Users/redacted/Documents/Projects/redacted/node_modules/stylelint/lib/index.js"
[Debug - 12:39:14 a.m.] [language-server] Running Stylelint | options: {"ignoreDisables":false,"reportNeedlessDisables":false,"reportInvalidScopeDisables":false,"ignorePath":"/Users/redacted/Documents/Projects/redacted/.stylelintignore","code":"...","codeFilename":"/Users/redacted/Documents/Projects/redacted/src/App.module.css"}
[Debug - 12:39:14 a.m.] [language-server] Lint run complete | uri: "file:///Users/redacted/Documents/Projects/redacted/src/App.module.css" results: {"diagnostics":[{"range":{"start":{"line":11,"character":0},"end":{"line":11,"character":0}},"message":"Expected selector ".logo" to come before selector ".app .logo" (no-descending-specificity)","severity":1,"code":"no-descending-specificity","source":"Stylelint","codeDescription":{"href":"https://stylelint.io/user-guide/rules/no-descending-specificity"}},{"range":{"start":{"line":5,"character":0},"end":{"line":5,"character":0}},"message":"Unexpected duplicate selector ".app", first used at line 1 (no-duplicate-selectors)","severity":1,"code":"no-duplicate-selectors","source":"Stylelint","codeDescription":{"href":"https://stylelint.io/user-guide/rules/no-duplicate-selectors"}}]}
[Debug - 12:39:14 a.m.] [language-server:validator] Sending diagnostics | uri: "file:///Users/redacted/Documents/Projects/redacted/src/App.module.css" result: {"diagnostics":[{"range":{"start":{"line":11,"character":0},"end":{"line":11,"character":0}},"message":"Expected selector ".logo" to come before selector ".app .logo" (no-descending-specificity)","severity":1,"code":"no-descending-specificity","source":"Stylelint","codeDescription":{"href":"https://stylelint.io/user-guide/rules/no-descending-specificity"}},{"range":{"start":{"line":5,"character":0},"end":{"line":5,"character":0}},"message":"Unexpected duplicate selector ".app", first used at line 1 (no-duplicate-selectors)","severity":1,"code":"no-duplicate-selectors","source":"Stylelint","codeDescription":{"href":"https://stylelint.io/user-guide/rules/no-duplicate-selectors"}}]}
[Debug - 12:39:14 a.m.] [language-server:validator] Diagnostics sent | uri: "file:///Users/redacted/Documents/Projects/redacted/src/App.module.css"
[Debug - 12:39:14 a.m.] [language-server:code-action] Received onCodeAction | uri: "file:///Users/redacted/Documents/Projects/redacted/src/App.module.css" context: {"diagnostics":[]}
[Debug - 12:39:14 a.m.] [language-server:code-action] Unsupported code action kind, ignoring | kind: undefined
[Debug - 12:39:26 a.m.] [language-server:code-action] Received onCodeAction | uri: "file:///Users/redacted/Documents/Projects/redacted/src/App.module.css" context: {"diagnostics":[{"range":{"start":{"line":11,"character":0},"end":{"line":11,"character":0}},"message":"Expected selector ".logo" to come before selector ".app .logo" (no-descending-specificity)","code":"no-descending-specificity","codeDescription":{"href":"https://stylelint.io/user-guide/rules/no-descending-specificity"},"severity":1,"source":"Stylelint"}],"only":["quickfix"]}
[Debug - 12:39:26 a.m.] [language-server:code-action] Unsupported code action kind, ignoring | kind: "quickfix"
[Debug - 12:39:45 a.m.] [language-server:code-action] Received onCodeAction | uri: "file:///Users/redacted/Documents/Projects/redacted/src/App.module.css" context: {"diagnostics":[{"range":{"start":{"line":5,"character":0},"end":{"line":5,"character":0}},"message":"Unexpected duplicate selector ".app", first used at line 1 (no-duplicate-selectors)","code":"no-duplicate-selectors","codeDescription":{"href":"https://stylelint.io/user-guide/rules/no-duplicate-selectors"},"severity":1,"source":"Stylelint"}],"only":["quickfix"]}
[Debug - 12:39:45 a.m.] [language-server:code-action] Unsupported code action kind, ignoring | kind: "quickfix"
Stylelint Version
14.0.1
vscode-stylelint Version
v1.1.0
Node.js Version
v16.13.0
Operating System
macOS 12.0.1
Windows Subsystem for Linux
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: