dventimiglia / eglot-problem-description

Emacs eglot problem description

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem

Sometimes, when I open a Dart file, the language server started by Eglot with dart language-server --client-id emacs.eglot-dart seems to fail with timed-out request errors. That is, the Eglot events buffer shows

[jsonrpc] i[13:23:34.826] [2] timed-out request ':textDocument/inlayHint'
[jsonrpc] i[13:23:38.966] [3] timed-out request ':textDocument/hover'
[jsonrpc] i[13:23:38.978] [4] timed-out request ':textDocument/documentHighlight'
[jsonrpc] i[13:23:38.978] [5] timed-out request ':textDocument/signatureHelp'

Restarting Eglot typically fixes it, though I then have to close the buffer and re-open the Dart file.

NOTE: In my experience, this only happens sometimes.

Dart Language Server usage

NOTE: Here’s the usage for the Dart language server.

dart language-server --help
Start Dart's analysis server.

This is a long-running process used to provide language services to IDEs and other tooling clients.

It communicates over stdin and stdout and provides services like code completion, errors and warnings, and refactorings. This command is generally not user-facing but consumed by higher level tools.

For more information about the server's capabilities and configuration, see:

  https://github.com/dart-lang/sdk/tree/main/pkg/analysis_server

Usage: dart language-server [arguments]
    --client-id=<name>                    An identifier for the analysis server client.
    --client-version=<version>            The version of the analysis server client.
    --dart-sdk=<path>                     Override the Dart SDK to use for analysis.
    --cache=<path>                        Override the location of the analysis server's cache.
    --packages=<path>                     The path to the package resolution configuration file, which supplies a mapping of package names
                                          into paths.
    --protocol=<protocol>                 Specify the protocol to use to communicate with the analysis server.

          [analyzer]                      Dart's analysis server protocol (https://dart.dev/go/analysis-server-protocol)
          [lsp] (default)                 The Language Server Protocol (https://microsoft.github.io/language-server-protocol)

Server diagnostics:
    --protocol-traffic-log=<file path>    Write server protocol traffic to the given file.
    --analysis-driver-log=<file path>     Write analysis driver diagnostic data to the given file.
    --diagnostic-port=<port>              Serve a web UI for status and performance data on the given port.
-h, --help                                Print this usage information.

Run "dart help" to see global options.

Diffing language server initialization between Eglot and VSCode.

NOTE: Here’s a diff between the way Eglot initializes the language server (top) and the way VSCode initializes the language server.

diff \
  <(jq -S 'def post_recurse(f): def r: (f | select(. != null) | r), .; r; def post_recurse: post_recurse(.[]?); (. | (post_recurse | arrays) |= sort)' "lsp_init_eglot.json") \
  <(jq -S 'def post_recurse(f): def r: (f | select(. != null) | r), .; r; def post_recurse: post_recurse(.[]?); (. | (post_recurse | arrays) |= sort)' "lsp_init_vscode.json")
2c2,3
<   "id": 1,
---
>   "clientRequestTime": 1719957377248,
>   "id": 0,
7c8,21
<       "experimental": {},
---
>       "experimental": {
>         "commands": [
>           "dart.goToLocation"
>         ],
>         "dartCodeAction": {
>           "commandParameterSupport": {
>             "supportedKinds": [
>               "saveUri"
>             ]
>           }
>         },
>         "snippetTextEdit": true,
>         "supportsWindowShowMessageRequest": true
>       },
8a23,56
>         "markdown": {
>           "allowedTags": [
>             "a",
>             "blockquote",
>             "br",
>             "code",
>             "del",
>             "div",
>             "em",
>             "h1",
>             "h2",
>             "h3",
>             "h4",
>             "h5",
>             "h6",
>             "hr",
>             "img",
>             "li",
>             "ol",
>             "p",
>             "pre",
>             "span",
>             "strong",
>             "table",
>             "tbody",
>             "td",
>             "th",
>             "thead",
>             "tr",
>             "ul"
>           ],
>           "parser": "marked",
>           "version": "1.1.0"
>         },
10,13c58,77
<           "utf-16",
<           "utf-32",
<           "utf-8"
<         ]
---
>           "utf-16"
>         ],
>         "regularExpressions": {
>           "engine": "ECMAScript",
>           "version": "ES2020"
>         },
>         "staleRequestSupport": {
>           "cancel": true,
>           "retryOnContentModified": [
>             "textDocument/semanticTokens/full",
>             "textDocument/semanticTokens/full/delta",
>             "textDocument/semanticTokens/range"
>           ]
>         }
>       },
>       "notebookDocument": {
>         "synchronization": {
>           "dynamicRegistration": true,
>           "executionSummarySupport": true
>         }
15a80,82
>         "callHierarchy": {
>           "dynamicRegistration": true
>         },
19a87
>                 "",
31c99,101
<           "dynamicRegistration": false,
---
>           "disabledSupport": true,
>           "dynamicRegistration": true,
>           "honorsChangeAnnotations": false,
35d104
<               "command",
39a109,114
>         "codeLens": {
>           "dynamicRegistration": true
>         },
>         "colorProvider": {
>           "dynamicRegistration": true
>         },
41a117
>             "commitCharactersSupport": true,
42a119,131
>             "documentationFormat": [
>               "markdown",
>               "plaintext"
>             ],
>             "insertReplaceSupport": true,
>             "insertTextModeSupport": {
>               "valueSet": [
>                 1,
>                 2
>               ]
>             },
>             "labelDetailsSupport": true,
>             "preselectSupport": true,
46c135
<                 "details",
---
>                 "detail",
56a146,182
>           "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"
>             ]
>           },
58c184,185
<           "dynamicRegistration": false
---
>           "dynamicRegistration": true,
>           "insertTextMode": 2
61c188
<           "dynamicRegistration": false,
---
>           "dynamicRegistration": true,
65c192
<           "dynamicRegistration": false,
---
>           "dynamicRegistration": true,
67a195,198
>         "diagnostic": {
>           "dynamicRegistration": true,
>           "relatedDocumentSupport": false
>         },
69c200,204
<           "dynamicRegistration": false
---
>           "dynamicRegistration": true
>         },
>         "documentLink": {
>           "dynamicRegistration": true,
>           "tooltipSupport": true
72c207
<           "dynamicRegistration": false,
---
>           "dynamicRegistration": true,
73a209
>           "labelSupport": true,
102a239,243
>           },
>           "tagSupport": {
>             "valueSet": [
>               1
>             ]
104a246,260
>         "foldingRange": {
>           "dynamicRegistration": true,
>           "foldingRange": {
>             "collapsedText": false
>           },
>           "foldingRangeKind": {
>             "valueSet": [
>               "comment",
>               "imports",
>               "region"
>             ]
>           },
>           "lineFoldingOnly": true,
>           "rangeLimit": 5000
>         },
106c262
<           "dynamicRegistration": false
---
>           "dynamicRegistration": true
113c269
<           "dynamicRegistration": false
---
>           "dynamicRegistration": true
116c272
<           "dynamicRegistration": false,
---
>           "dynamicRegistration": true,
120c276,294
<           "dynamicRegistration": false
---
>           "dynamicRegistration": true,
>           "resolveSupport": {
>             "properties": [
>               "label.command",
>               "label.location",
>               "label.tooltip",
>               "textEdits",
>               "tooltip"
>             ]
>           }
>         },
>         "inlineValue": {
>           "dynamicRegistration": true
>         },
>         "linkedEditingRange": {
>           "dynamicRegistration": true
>         },
>         "onTypeFormatting": {
>           "dynamicRegistration": true
123,124c297,299
<           "codeDescriptionSupport": false,
<           "relatedInformation": false,
---
>           "codeDescriptionSupport": true,
>           "dataSupport": true,
>           "relatedInformation": true,
130c305,306
<           }
---
>           },
>           "versionSupport": false
133c309
<           "dynamicRegistration": false
---
>           "dynamicRegistration": true
136c312
<           "dynamicRegistration": false
---
>           "dynamicRegistration": true
139c315,374
<           "dynamicRegistration": false
---
>           "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": [
>             "abstract",
>             "async",
>             "declaration",
>             "defaultLibrary",
>             "definition",
>             "deprecated",
>             "documentation",
>             "modification",
>             "readonly",
>             "static"
>           ],
>           "tokenTypes": [
>             "class",
>             "comment",
>             "decorator",
>             "enum",
>             "enumMember",
>             "event",
>             "function",
>             "interface",
>             "keyword",
>             "macro",
>             "method",
>             "modifier",
>             "namespace",
>             "number",
>             "operator",
>             "parameter",
>             "property",
>             "regexp",
>             "string",
>             "struct",
>             "type",
>             "typeParameter",
>             "variable"
>           ]
142c377,378
<           "dynamicRegistration": false,
---
>           "contextSupport": true,
>           "dynamicRegistration": true,
156c392
<           "dynamicRegistration": false,
---
>           "dynamicRegistration": true,
161c397
<           "dynamicRegistration": false,
---
>           "dynamicRegistration": true,
162a399,401
>         },
>         "typeHierarchy": {
>           "dynamicRegistration": true
168a408,412
>         "showMessage": {
>           "messageActionItem": {
>             "additionalPropertiesSupport": true
>           }
>         },
172a417,419
>         "codeLens": {
>           "refreshSupport": true
>         },
174c421,424
<         "didChangeWatchedFiles": {
---
>         "diagnostics": {
>           "refreshSupport": true
>         },
>         "didChangeConfiguration": {
176a427,430
>         "didChangeWatchedFiles": {
>           "dynamicRegistration": true,
>           "relativePatternSupport": true
>         },
178c432,450
<           "dynamicRegistration": false
---
>           "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
181c453,493
<           "dynamicRegistration": false
---
>           "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
>             ]
>           }
184c496,506
<           "documentChanges": true
---
>           "changeAnnotationSupport": {
>             "groupsOnLabel": true
>           },
>           "documentChanges": true,
>           "failureHandling": "textOnlyTransactional",
>           "normalizesLineEndings": true,
>           "resourceOperations": [
>             "create",
>             "delete",
>             "rename"
>           ]
190,191c512,513
<       "name": "Eglot",
<       "version": "1.17"
---
>       "name": "Visual Studio Code",
>       "version": "1.90.2"
193,202c515,531
<     "initializationOptions": {},
<     "processId": 147340,
<     "rootPath": "/home/davidaventimiglia/Scratch/eglot-problem-description/",
<     "rootUri": "file:///home/davidaventimiglia/Scratch/eglot-problem-description",
<     "workspaceFolders": [
<       {
<         "name": "~/Scratch/eglot-problem-description/",
<         "uri": "file:///home/davidaventimiglia/Scratch/eglot-problem-description"
<       }
<     ]
---
>     "initializationOptions": {
>       "allowOpenUri": true,
>       "appHost": "desktop",
>       "closingLabels": true,
>       "flutterOutline": false,
>       "onlyAnalyzeProjectsWithOpenFiles": false,
>       "outline": true,
>       "previewSurveys": true,
>       "suggestFromUnimportedLibraries": true,
>       "useInEditorDartFixPrompt": false
>     },
>     "locale": "en",
>     "processId": 301117,
>     "rootPath": null,
>     "rootUri": null,
>     "trace": "off",
>     "workspaceFolders": null

Checklist

  1. Include the transcript of JSONRPC events obtained from the buffer popped up by M-x eglot-events-buffer. You may narrow down the transcript if you are sure of where the problematic exchange is, but it’s safer to include the whole transcript, either attached or inline.
    Answer
    See transcript from m-x eglot-events-buffer below.
    [jsonrpc] D[05:56:11.451] Running language server: dart language-server --client-id emacs.eglot-dart
    [jsonrpc] e[05:56:11.451] --> initialize[1] {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":147340,"clientInfo":{"name":"Eglot","version":"1.17"},"rootPath":"/home/davidaventimiglia/Scratch/eglot-problem-description/","rootUri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description","initializationOptions":{},"capabilities":{"workspace":{"applyEdit":true,"executeCommand":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":false},"configuration":true,"workspaceFolders":true},"textDocument":{"synchronization":{"dynamicRegistration":false,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":false,"completionItem":{"snippetSupport":true,"deprecatedSupport":true,"resolveSupport":{"properties":["documentation","details","additionalTextEdits"]},"tagSupport":{"valueSet":[1]}},"contextSupport":true},"hover":{"dynamicRegistration":false,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":false,"signatureInformation":{"parameterInformation":{"labelOffsetSupport":true},"documentationFormat":["markdown","plaintext"],"activeParameterSupport":true}},"references":{"dynamicRegistration":false},"definition":{"dynamicRegistration":false,"linkSupport":true},"declaration":{"dynamicRegistration":false,"linkSupport":true},"implementation":{"dynamicRegistration":false,"linkSupport":true},"typeDefinition":{"dynamicRegistration":false,"linkSupport":true},"documentSymbol":{"dynamicRegistration":false,"hierarchicalDocumentSymbolSupport":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]}},"documentHighlight":{"dynamicRegistration":false},"codeAction":{"dynamicRegistration":false,"resolveSupport":{"properties":["edit","command"]},"dataSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"isPreferredSupport":true},"formatting":{"dynamicRegistration":false},"rangeFormatting":{"dynamicRegistration":false},"rename":{"dynamicRegistration":false},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"relatedInformation":false,"codeDescriptionSupport":false,"tagSupport":{"valueSet":[1,2]}}},"window":{"showDocument":{"support":true},"workDoneProgress":true},"general":{"positionEncodings":["utf-32","utf-8","utf-16"]},"experimental":{}},"workspaceFolders":[{"uri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description","name":"~/Scratch/eglot-problem-description/"}]}}
    [jsonrpc] e[05:56:11.611] <-- initialize[1] {"id":1,"jsonrpc":"2.0","result":{"capabilities":{"callHierarchyProvider":true,"codeActionProvider":{"codeActionKinds":["source","source.organizeImports","source.fixAll","source.sortMembers","quickfix","refactor"]},"codeLensProvider":{},"colorProvider":{"documentSelector":[{"language":"dart","scheme":"file"}]},"completionProvider":{"completionItem":{"labelDetailsSupport":true},"resolveProvider":true,"triggerCharacters":[".","=","(","$","\"","'","{","/",":"]},"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentLinkProvider":{"resolveProvider":false},"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"}","moreTriggerCharacter":[";"]},"documentRangeFormattingProvider":true,"documentSymbolProvider":true,"executeCommandProvider":{"commands":["dart.edit.sortMembers","dart.edit.organizeImports","dart.edit.fixAll","dart.edit.fixAllInWorkspace.preview","dart.edit.fixAllInWorkspace","dart.edit.sendWorkspaceEdit","refactor.perform","refactor.validate","dart.logAction","dart.refactor.convert_all_formal_parameters_to_named","dart.refactor.convert_selected_formal_parameters_to_named","dart.refactor.move_selected_formal_parameters_left","dart.refactor.move_top_level_to_file"],"workDoneProgress":true},"experimental":{"textDocument":{"super":{},"augmented":{},"augmentation":{}}},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"inlayHintProvider":{"resolveProvider":false},"referencesProvider":true,"renameProvider":true,"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":false},"legend":{"tokenModifiers":["documentation","constructor","declaration","importPrefix","instance","static","escape","annotation","control","label","interpolation","void"],"tokenTypes":["annotation","keyword","class","comment","method","variable","parameter","enum","enumMember","type","source","property","namespace","boolean","number","string","function","typeParameter"]},"range":true},"signatureHelpProvider":{"retriggerCharacters":[","],"triggerCharacters":["("]},"textDocumentSync":{"change":2,"openClose":true,"willSave":false,"willSaveWaitUntil":false},"typeDefinitionProvider":true,"typeHierarchyProvider":true,"workspace":{"fileOperations":{"willRename":{"filters":[{"pattern":{"glob":"**/*.dart","matches":"file"},"scheme":"file"},{"pattern":{"glob":"**/","matches":"folder"},"scheme":"file"}]}},"workspaceFolders":{"changeNotifications":true,"supported":true}},"workspaceSymbolProvider":true},"serverInfo":{"name":"Dart SDK LSP Analysis Server","version":"3.4.4"}}}
    [jsonrpc] e[05:56:11.611] --> initialized {"jsonrpc":"2.0","method":"initialized","params":{}}
    [jsonrpc] e[05:56:11.612] --> textDocument/didOpen {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description/main.dart","version":0,"languageId":"dart","text":"void main() {\n  print(\"Hello, World!\");\n}\n"}}}
    [jsonrpc] e[05:56:11.612] --> workspace/didChangeConfiguration {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}
    [jsonrpc] e[05:56:11.636] --> textDocument/inlayHint[2] {"jsonrpc":"2.0","id":2,"method":"textDocument/inlayHint","params":{"textDocument":{"uri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description/main.dart"},"range":{"start":{"line":0,"character":0},"end":{"line":3,"character":0}}}}
    [jsonrpc] e[05:56:11.663] <-- workspace/configuration[1] {"id":1,"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description","section":"dart"},{"section":"dart"}]}}
    [jsonrpc] e[05:56:11.664] --> workspace/configuration[1] {"jsonrpc":"2.0","id":1,"result":[null,null]}
    [jsonrpc] e[05:56:11.664] <-- window/workDoneProgress/create[2] {"id":2,"jsonrpc":"2.0","method":"window/workDoneProgress/create","params":{"token":"ANALYZING"}}
    [jsonrpc] e[05:56:11.664] --> window/workDoneProgress/create[2] {"jsonrpc":"2.0","id":2,"result":null}
    [jsonrpc] e[05:56:11.664] <-- workspace/configuration[3] {"id":3,"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description","section":"dart"},{"section":"dart"}]}}
    [jsonrpc] e[05:56:11.664] --> workspace/configuration[3] {"jsonrpc":"2.0","id":3,"result":[null,null]}
    [jsonrpc] e[05:56:12.137] --> textDocument/hover[3] {"jsonrpc":"2.0","id":3,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description/main.dart"},"position":{"line":0,"character":0}}}
    [jsonrpc] e[05:56:12.138] --> textDocument/documentHighlight[4] {"jsonrpc":"2.0","id":4,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description/main.dart"},"position":{"line":0,"character":0}}}
    [jsonrpc] e[05:56:12.138] --> textDocument/signatureHelp[5] {"jsonrpc":"2.0","id":5,"method":"textDocument/signatureHelp","params":{"textDocument":{"uri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description/main.dart"},"position":{"line":0,"character":0}}}
    [jsonrpc] i[05:56:21.637] [2] timed-out request ':textDocument/inlayHint'
    [jsonrpc] i[05:56:22.138] [3] timed-out request ':textDocument/hover'
    [jsonrpc] i[05:56:22.138] [4] timed-out request ':textDocument/documentHighlight'
    [jsonrpc] i[05:56:22.144] [5] timed-out request ':textDocument/signatureHelp'
        

    NOTE: Here’s a transcript from m-x eglot-events-buffer on an occasion when it /doesn’t` time out:

    [jsonrpc] D[09:46:20.327] Running language server: dart language-server --client-id emacs.eglot-dart
    [jsonrpc] e[09:46:20.327] --> initialize[1] {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":165982,"clientInfo":{"name":"Eglot","version":"1.17"},"rootPath":"/home/davidaventimiglia/Scratch/eglot-problem-description/","rootUri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description","initializationOptions":{},"capabilities":{"workspace":{"applyEdit":true,"executeCommand":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":false},"configuration":true,"workspaceFolders":true},"textDocument":{"synchronization":{"dynamicRegistration":false,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":false,"completionItem":{"snippetSupport":true,"deprecatedSupport":true,"resolveSupport":{"properties":["documentation","details","additionalTextEdits"]},"tagSupport":{"valueSet":[1]}},"contextSupport":true},"hover":{"dynamicRegistration":false,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":false,"signatureInformation":{"parameterInformation":{"labelOffsetSupport":true},"documentationFormat":["markdown","plaintext"],"activeParameterSupport":true}},"references":{"dynamicRegistration":false},"definition":{"dynamicRegistration":false,"linkSupport":true},"declaration":{"dynamicRegistration":false,"linkSupport":true},"implementation":{"dynamicRegistration":false,"linkSupport":true},"typeDefinition":{"dynamicRegistration":false,"linkSupport":true},"documentSymbol":{"dynamicRegistration":false,"hierarchicalDocumentSymbolSupport":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]}},"documentHighlight":{"dynamicRegistration":false},"codeAction":{"dynamicRegistration":false,"resolveSupport":{"properties":["edit","command"]},"dataSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"isPreferredSupport":true},"formatting":{"dynamicRegistration":false},"rangeFormatting":{"dynamicRegistration":false},"rename":{"dynamicRegistration":false},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"relatedInformation":false,"codeDescriptionSupport":false,"tagSupport":{"valueSet":[1,2]}}},"window":{"showDocument":{"support":true},"workDoneProgress":true},"general":{"positionEncodings":["utf-32","utf-8","utf-16"]},"experimental":{}},"workspaceFolders":[{"uri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description","name":"~/Scratch/eglot-problem-description/"}]}}
    [jsonrpc] e[09:46:20.489] <-- initialize[1] {"id":1,"jsonrpc":"2.0","result":{"capabilities":{"callHierarchyProvider":true,"codeActionProvider":{"codeActionKinds":["source","source.organizeImports","source.fixAll","source.sortMembers","quickfix","refactor"]},"codeLensProvider":{},"colorProvider":{"documentSelector":[{"language":"dart","scheme":"file"}]},"completionProvider":{"completionItem":{"labelDetailsSupport":true},"resolveProvider":true,"triggerCharacters":[".","=","(","$","\"","'","{","/",":"]},"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentLinkProvider":{"resolveProvider":false},"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"}","moreTriggerCharacter":[";"]},"documentRangeFormattingProvider":true,"documentSymbolProvider":true,"executeCommandProvider":{"commands":["dart.edit.sortMembers","dart.edit.organizeImports","dart.edit.fixAll","dart.edit.fixAllInWorkspace.preview","dart.edit.fixAllInWorkspace","dart.edit.sendWorkspaceEdit","refactor.perform","refactor.validate","dart.logAction","dart.refactor.convert_all_formal_parameters_to_named","dart.refactor.convert_selected_formal_parameters_to_named","dart.refactor.move_selected_formal_parameters_left","dart.refactor.move_top_level_to_file"],"workDoneProgress":true},"experimental":{"textDocument":{"super":{},"augmented":{},"augmentation":{}}},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"inlayHintProvider":{"resolveProvider":false},"referencesProvider":true,"renameProvider":true,"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":false},"legend":{"tokenModifiers":["documentation","constructor","declaration","importPrefix","instance","static","escape","annotation","control","label","interpolation","void"],"tokenTypes":["annotation","keyword","class","comment","method","variable","parameter","enum","enumMember","type","source","property","namespace","boolean","number","string","function","typeParameter"]},"range":true},"signatureHelpProvider":{"retriggerCharacters":[","],"triggerCharacters":["("]},"textDocumentSync":{"change":2,"openClose":true,"willSave":false,"willSaveWaitUntil":false},"typeDefinitionProvider":true,"typeHierarchyProvider":true,"workspace":{"fileOperations":{"willRename":{"filters":[{"pattern":{"glob":"**/*.dart","matches":"file"},"scheme":"file"},{"pattern":{"glob":"**/","matches":"folder"},"scheme":"file"}]}},"workspaceFolders":{"changeNotifications":true,"supported":true}},"workspaceSymbolProvider":true},"serverInfo":{"name":"Dart SDK LSP Analysis Server","version":"3.4.4"}}}
    [jsonrpc] e[09:46:20.489] --> initialized {"jsonrpc":"2.0","method":"initialized","params":{}}
    [jsonrpc] e[09:46:20.490] --> textDocument/didOpen {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description/eglot-problem-description-main/main.dart","version":0,"languageId":"dart","text":"void main() {\n  print(\"Hello, World!\");\n}\n"}}}
    [jsonrpc] e[09:46:20.490] --> workspace/didChangeConfiguration {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}
    [jsonrpc] e[09:46:20.514] --> textDocument/inlayHint[2] {"jsonrpc":"2.0","id":2,"method":"textDocument/inlayHint","params":{"textDocument":{"uri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description/eglot-problem-description-main/main.dart"},"range":{"start":{"line":0,"character":0},"end":{"line":3,"character":0}}}}
    [jsonrpc] e[09:46:20.519] <-- workspace/configuration[1] {"id":1,"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description","section":"dart"},{"section":"dart"}]}}
    [jsonrpc] e[09:46:20.520] --> workspace/configuration[1] {"jsonrpc":"2.0","id":1,"result":[null,null]}
    [jsonrpc] e[09:46:20.520] <-- window/workDoneProgress/create[2] {"id":2,"jsonrpc":"2.0","method":"window/workDoneProgress/create","params":{"token":"ANALYZING"}}
    [jsonrpc] e[09:46:20.520] --> window/workDoneProgress/create[2] {"jsonrpc":"2.0","id":2,"result":null}
    [jsonrpc] e[09:46:20.520] <-- workspace/configuration[3] {"id":3,"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description","section":"dart"},{"section":"dart"}]}}
    [jsonrpc] e[09:46:20.520] --> workspace/configuration[3] {"jsonrpc":"2.0","id":3,"result":[null,null]}
    [jsonrpc] e[09:46:20.657] <-- $/progress {"jsonrpc":"2.0","method":"$/progress","params":{"token":"ANALYZING","value":{"kind":"begin","title":"Analyzing…"}}}
    [jsonrpc] e[09:46:20.657] <-- $/progress {"jsonrpc":"2.0","method":"$/progress","params":{"token":"ANALYZING","value":{"kind":"end"}}}
    [jsonrpc] e[09:46:20.657] <-- textDocument/inlayHint[2] {"id":2,"jsonrpc":"2.0","result":[{"kind":2,"label":[{"location":{"range":{"end":{"character":25,"line":18},"start":{"character":19,"line":18}},"uri":"file:///usr/lib/dart/lib/core/print.dart"},"value":"object:"}],"paddingRight":true,"position":{"character":8,"line":1}}]}
    [jsonrpc] e[09:46:21.020] --> textDocument/hover[3] {"jsonrpc":"2.0","id":3,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description/eglot-problem-description-main/main.dart"},"position":{"line":0,"character":0}}}
    [jsonrpc] e[09:46:21.021] --> textDocument/documentHighlight[4] {"jsonrpc":"2.0","id":4,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description/eglot-problem-description-main/main.dart"},"position":{"line":0,"character":0}}}
    [jsonrpc] e[09:46:21.022] --> textDocument/signatureHelp[5] {"jsonrpc":"2.0","id":5,"method":"textDocument/signatureHelp","params":{"textDocument":{"uri":"file:///home/davidaventimiglia/Scratch/eglot-problem-description/eglot-problem-description-main/main.dart"},"position":{"line":0,"character":0}}}
    [jsonrpc] e[09:46:21.070] <-- textDocument/hover[3] {"id":3,"jsonrpc":"2.0","result":{"contents":{"kind":"markdown","value":""},"range":{"end":{"character":4,"line":0},"start":{"character":0,"line":0}}}}
    [jsonrpc] e[09:46:21.109] <-- textDocument/documentHighlight[4] {"id":4,"jsonrpc":"2.0","result":null}
    [jsonrpc] e[09:46:21.109] <-- textDocument/signatureHelp[5] {"id":5,"jsonrpc":"2.0","result":null}
        
  2. If Emacs signaled an error (an error message was seen or heard), make sure to repeat the process after turning on debug-on-error via M-x toggle-debug-on-error. This normally produces a backtrace of the error that should also be attached to the bug report.
    Answer
    Emacs does not signal an error.
  3. Include a description of how the maintainer should obtain, install, and configure the language server you used. Maintainers usually have access to GNU/Linux systems, though not necessarily the distribution that you may be using. If possible, try to replicate the problem with the C/C++ or Python servers, as these are very easy to install.
    Answer
    Follow the instructions to Install the Dart SDK for your OS.
  4. Describe how to setup a minimal project directory where Eglot should be started for the problem to happen. Describe each file’s name and its contents. Alternatively, you can supply the address of a public Git repository.
    Answer
    A minimal project directory is in this GitHub repository here.
  5. Include versions of the software used. The Emacs version can be obtained with M-x emacs-version. We welcome bug reports about all Eglot versions, but it is helpful to first check if the problem isn’t already fixed in the latest version (see Getting the latest version). It’s also essential to include the version of ELPA packages that are explicitly or implicitly loaded. The optional but popular Company or Markdown packages are distributed as GNU ELPA packages, not to mention Eglot itself in some situations. Some major modes (Go, Rust, etc.) are provided by ELPA packages. It’s sometimes easy to miss these, since they are usually implicitly loaded when visiting a file in that language. ELPA packages usually live in ~/.emacs.d/elpa (or what is in package-user-dir). Including a listing of files in that directory is a way to tell the maintainers about ELPA package versions.
    Answer
    dart-mode Version: 1.0.7; emacs Version: see below
    (emacs-version)
        
    GNU Emacs 29.4 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
     of 2024-06-23
        
  6. Include a recipe to replicate the problem with a clean Emacs run. The invocation emacs -Q -f package-initialize starts Emacs with no configuration and initializes the ELPA packages. A very minimal .emacs initialization file (10 lines or less) is also acceptable and good means to describe changes to variables. There is usually no need to include require statements in the recipe, as Eglot’s functionality uses autoloads. Likewise, there is rarely the need to use things like use-package or eglot-ensure. This just makes the recipe harder to follow. Prefer setting variables with setq and adding to hooks with add-hook. Prefer starting Eglot with M-x eglot.
    Answer
    see steps below.
    1. Download this repository.
      wget -O main.zip https://github.com/dventimiglia/eglot-problem-description/archive/refs/heads/main.zip
              
    2. Unzip the archive.
      unzip -o main.zip
              

    3. Launch emacs with the Dart file.
      cd eglot-problem-description-main
      emacs -Q -f package-initialize -l init.el main.dart
              
    4. Run m-x eglot in the new Emacs session.
    5. Open the events buffer with m-x eglot-events-buffer.
    6. With a little luck, observe something like this at the end of the events buffer.
      [jsonrpc] i[07:42:09.464] [2] timed-out request ':textDocument/inlayHint'
      [jsonrpc] i[07:42:09.967] [3] timed-out request ':textDocument/hover'
      [jsonrpc] i[07:42:09.972] [4] timed-out request ':textDocument/documentHighlight'
      [jsonrpc] i[07:42:09.972] [5] timed-out request ':textDocument/signatureHelp'
              
  7. Make sure to double check all the above elements and re-run the recipe to see that the problem is reproducible. Following the recipe should produce event transcript and error backtraces that are very similar to the ones you included. If the problem only happens sometimes, mention this in your report.
    Answer
    I double checked all the above elements and re-ran the recipe several times. As the problem is intermittent, it occured sometimes for me. Other times, it did not.

About

Emacs eglot problem description


Languages

Language:Dart 53.4%Language:Emacs Lisp 46.6%