Skip to content

Provide DTD address to analysis server #5090

Closed

Description

@kenzieschmoll

Depends on an API being established and implemented on the analysis server side for setting the DTD address.
dart-lang/sdk#55629

Mirrored tracking issue for IntelliJ: flutter/flutter-intellij#7399

Activity

  1. added this to the v3.90.0 milestone on May 9, 2024
  2. modified the milestones: v3.90.0, v3.92.0 on May 20, 2024
  3. modified the milestones: v3.92.0, v3.94.0 on Jun 24, 2024
  4. modified the milestones: v3.94.0, v3.96.0 on Jul 22, 2024
  5. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    and removed on Aug 21, 2024
  6. DanTup commented on Aug 21, 2024

    @DanTup
    Member

    I have a change open at https://dart-review.googlesource.com/c/sdk/+/379303 that allows the server to accept a DTD URI and connect to it, exposing the shared LSP handlers.

    I've also pushed a change here that adds a preview flag "dart.previewDtdLspIntegration": true that will call that method to establish this connection. To enable this without a flag in future we'll need to make some further server changes (to advertise that this is available), but we should have more testing before doing that.

    When using Dart-Code and an SDK with those changes, you can see the LSP request registered over DTD (you need to streamListen for Service for ServiceRegistered and Lsp if you want the initialized event):

    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"dart/textDocument/augmentation"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"dart/textDocument/augmented"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"textDocument/codeLens"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"dart/textDocumentContent"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"textDocument/documentColor"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"textDocument/colorPresentation"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"textDocument/documentHighlight"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"textDocument/documentSymbol"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"textDocument/onTypeFormatting"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"textDocument/rangeFormatting"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"textDocument/formatting"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"textDocument/hover"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"textDocument/implementation"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"callHierarchy/incomingCalls"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"callHierarchy/outgoingCalls"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"textDocument/prepareCallHierarchy"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"textDocument/prepareTypeHierarchy"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"textDocument/signatureHelp"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"dart/textDocument/super"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"textDocument/typeDefinition"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"typeHierarchy/subtypes"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"typeHierarchy/supertypes"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"workspace/willRenameFiles"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Service","eventKind":"ServiceRegistered","eventData":{"service":"Lsp","method":"workspace/symbol"},"timestamp":1724248142408}}
    [2:49:02 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Lsp","eventKind":"initialized","eventData":{},"timestamp":1724248142441}}
    

    You can then call these methods over DTD:

    [2:49:11 PM] [DartToolingDaemon] [Info] ==> {"id":"1234","jsonrpc":"2.0","method":"Lsp.textDocument/hover","params":{"position":{"line":1,"character":2},"textDocument":{"uri":"file:///C:/Dev/Dart-Code/Dart-Code/src/test/test_projects/hello_world/lib/deferred_script.dart"}}}
    [2:49:12 PM] [DartToolingDaemon] [Info] <== {"jsonrpc":"2.0","result":{"type":"Hover","result":{"contents":{"kind":"markdown","value":"```dart\nvoid print(Object? object)\n```\nType: `void Function(Object?)`\n\n*dart:core*\n\n---\nPrints an object to the console.\n\nOn the web, `object` is converted to a string and that string is output to\nthe web console using `console.log`.\n\nOn native (non-Web) platforms, `object` is converted to a string and that\nstring is terminated by a line feed (`'\\n'`, U+000A) and written to\n`stdout`. On Windows, the terminating line feed, and any line feeds in the\nstring representation of `object`, are output using the Windows line\nterminator sequence of (`'\\r\\n'`, U+000D + U+000A).\n\nCalls to `print` can be intercepted by [Zone.print]."},"range":{"end":{"character":7,"line":1},"start":{"character":2,"line":1}}}},"id":"1234"}
    

    There's still more to do (such as scheduling in the server, and figuring out how client capabilities should be handled), but it's hopefully near a point that other development can be started against it (using the preview flags).

  7. 5 remaining items

  8. modified the milestones: v3.100.0, v3.102.0 on Oct 28, 2024
  9. DanTup commented on Oct 28, 2024

    @DanTup
    Member

    The work for passing the DTD URI to the analysis server (and for it to connect) is done, but we're still behind a flag here because there's not been a huge amount of testing. I suggest we keep it behind the flag while the property editor work is done and then switch to gating on an SDK version where the property editor APIs are in a place we're happy with.

  10. modified the milestones: v3.102.0, v3.104.0 on Nov 26, 2024
  11. modified the milestones: v3.104.0, v3.106.0 on Dec 19, 2024
  12. modified the milestones: v3.106.0, v3.104.0 on Dec 30, 2024
  13. modified the milestones: v3.104.0, v3.106.0 on Jan 27, 2025
  14. modified the milestones: v3.106.0, v3.108.0 on Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions