Skip to content

Update analyze tool to use LSP, simplify tool #74

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

Merged
merged 8 commits into from
Apr 22, 2025
Merged

Update analyze tool to use LSP, simplify tool #74

merged 8 commits into from
Apr 22, 2025

Conversation

jakemac53
Copy link
Contributor

@jakemac53 jakemac53 commented Apr 21, 2025

  • Use dart language-server for errors, file watching, etc.
  • Drop analyzer dependency.
  • Depends on language_server_protocol package from the SDK using a git dependency for now:
    • We can fix this by moving into the SDK
    • Or publishing language_server_protocol
  • The tool now just always returns all errors for all known workspaces.
  • Errors are returned in a structured format right now instead of as a human readable string.
  • We might want to steal some code from analyzer/DartCode etc to get a human readable string going.
  • Or if this is just for AI input, structured may even be better.

In the future, we might try to use the DTD connection to talk, which won't change this code too much. But right now DTD has very limited support (read/write properties).

Closes #65 as well

Copy link

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

Copy link
Contributor

@kenzieschmoll kenzieschmoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but would be good to wait for @bwilkerson's review as well.

import 'dart:convert';

import 'package:async/async.dart';
import 'package:stream_channel/stream_channel.dart';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing that the analysis server must already have some similar code. At some point we should look at sharing the implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I would probably move it to be a part of the language_server_protocol package.

@jakemac53 jakemac53 merged commit fb87b34 into main Apr 22, 2025
13 checks passed
@jakemac53 jakemac53 deleted the lsp branch April 22, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad state: Unable to find the context to hidden file.
3 participants