357 Commits

Author SHA1 Message Date
Brian Wilkerson fe4d5ec163 Add initial documentation for sort members
Change-Id: I2f097d0f9eab08679dfa7660a698ea8dc1775cf4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507461
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-29 12:56:59 -07:00
Danny Tuppeny 26c646642d [analysis_server] Add kinds to LSP document highlights
Populates the `kind` on the Document Highlights we return. This allows colouring reads and writes differently (which it turns out VS Code does by default).

The options are a bit limited (Read/Write/Text) and using Read/Write for things like type names feels slightly odd, but the spec does seem to encourage this and it's what TypeScript is doing.

Fixes https://github.com/dart-lang/sdk/issues/62929

Change-Id: I6a53450038cde31b399b5b1aca5f964083106763
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/503060
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2026-05-12 12:04:29 -07:00
Brian Wilkerson 6272dd1d89 Add a design doc for document highlight
An attempt to capture some of the conclusions from recent discussions.

Please let me know if this doesn't sound reasonable or if there are
pieces I've missed (such as other exceptions to the general rule).

Change-Id: I2520a768de116be5d9a86f9cb4494dcad7d88f5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497780
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-04-24 16:20:12 -07:00
Brian Wilkerson 1fbb3d3bf4 Enhance refactor.md with code generation guidelines
Change-Id: I79bb7742cc9d4f04edb93d71f7c3450831214f01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493100
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-04-06 15:51:05 -07:00
Brian Wilkerson e46df0c464 Update the documentation on refactors to be more clear
I have attempted to make the doc more clear about the differences
between the different kinds of refactors.

I have also attempted to capture some of the conditions under which I
think it's reasonable for refactors to introduce diagnostics.

Let me know if it needs more work.

Change-Id: I2307f9e5eb9d3c0daa0b584dcde65b2c3d652f81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491342
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-03-30 09:30:39 -07:00
Sam Rawlins 7d0a17196c DAS plugins: Add print-debugging support in Insights pages.
Work towards https://github.com/dart-lang/sdk/issues/61868

This adds a new notification type, 'PluginPrint'. There are several
fields and variables then named 'pluginPrint' or 'print', and I am
definitely open to changing these names, but this is the best one that
I thought of.

PluginPrint has three fields: The name of the plugin that printed, the
message that was printed, and the timestamp.

We wrap each plugin's AnalysisRule invocations with a zone, so that
the `print` handler can know the name of the plugin. The prints are
caught and sent to the server isolate as Notifications. The
PluginIsolate then stores the collected prints. The Plugins Insights
page can then retrieve them and display them.

Manual testing, with 1000 libraries that get new lint reported once per
file, I did not observe a negative performance impact.

Change-Id: Id800ae41781c15ce89d06b563878c2b0edae43d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486827
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-03-16 14:56:59 -07:00
Brian Wilkerson 87a0f2e3af Add some design docs related to refactors
The question was raised recently about whether refactors should change
the semantics of the code, and if so under what conditions. There aren't
any hard-and-fast rules, but I wanted to capture the criteria I believe
we've generally used when making this decision.

Let me know if you think I've missed, or misrepresented, something.

Change-Id: I2d02dc35aa17386ff2ae8aa73ff0dc1271170ba4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/487220
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-03-12 11:15:00 -07:00
Brian Wilkerson 7fe34af78c Capture a decision about highlighting new
We made a decision about how to handle the `new` keyword in various
locations, and I thought it would be good to capture that decision.

Change-Id: I28373128955444dc09ad44c3fdab209020cc0bc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/487180
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-03-11 12:02:22 -07:00
Sam Rawlins cd31d6e158 DAS: Update tutorial text to use the word "insights"
Also add a bare minimum of documentation for the plugin pages.

Also correct some removed and added pages, all with TODOs.

Change-Id: I5ca48c9013c47f6fc925c1da1c44055d3884448b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/487081
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-03-11 10:37:49 -07:00
Danny Tuppeny 2a375317f4 [analysis_server] Deprecate HighlightRegionType.BUILT_IN and always use KEYWORD
Change-Id: I86ff7edc2b4de5910b19f6bdb0d4422b7546897a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482820
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-02-23 07:44:32 -08:00
Brian Wilkerson aa748501f0 Initial documentation for the design of semantic highlighting
Please let me know if you can think of any other areas of semantic
highlighting that need to be explained.

Change-Id: Ief41e04885996c9f64b6670d301f7d9f4e831278
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/474460
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-01-20 09:14:06 -08:00
Brian Wilkerson 9a79bc9c49 Initial documentation for the design of code completion
There are a couple of missing pieces (indicated by 'TBD'), but let me
know if there are other aspects of completion that ought to be
documented.

Change-Id: I2636e37fb780909eeb7a1b510332c40df60d31d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/474441
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-20 09:08:39 -08:00
Danny Tuppeny a3a9a3dfc8 [analysis_server] Add closing labels tests for primary constructor invocations
Change-Id: I6d6a9d511c795d60220fff900b3b3358c86265a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472222
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-01-12 08:41:59 -08:00
Brian Wilkerson f8b2feb1ed Add documentation for the principle of consistency
This feels kind of brief, especially compared to the language fidelity
principle. In addition to improvements to the existing text, please let
me know what needs to be added or expanded on.

Change-Id: I30705acb705a4aa94c8ba2c70757d3f44e2e09b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471402
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-09 07:28:10 -08:00
Brian Wilkerson 47c4c4f60e Make corrections to the language fidelity page
Change-Id: I250f02e1db2c78344936d9b6d3102019bf97d7f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465460
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-12-02 07:20:19 -08:00
Brian Wilkerson a27682c68e Enhance the docs for language fidelity
This fills in places that were previously left TBD, adds a new section,
re-organizes a bit for consistency, and cleans up some of the text.

Change-Id: I06eb32b6d2d8fe14c0bcf8b37ac8147cd08cafa1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464622
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-11-26 09:23:50 -08:00
Danny Tuppeny c8ab18f13e [analysis_server] Improve the display of unnamed extensions in LSP Outline, Document Symbols
We previously just showed "<unnamed extension>" for extensions without names, but in some files I noticed we have a lot of these, and the outline/symbols list looks awful (just "<unnamed extension>" repeated many times).

This changes it to instead show "extension on FooClass" instead (if there is a valid type name). I added a new field to the protocol to support this because the LSP classes convert from those classes (something we've discussed changing, but might be easier later).

Screenshots of before/after are in https://github.com/Dart-Code/Dart-Code/issues/5818

Fixes https://github.com/Dart-Code/Dart-Code/issues/5818

Change-Id: I3885a722443291bfa2419514841469c862b74450
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464560
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-11-25 13:49:55 -08:00
Brian Wilkerson 3f3454cccf Address feedback on a doc
This addresses feedback from the review at
https://dart-review.googlesource.com/c/sdk/+/461901
as well as a suggestion from an issue to add more to this doc.

Change-Id: Iaed409e01ef3a61bb89f8108bdf79aa5ce6145af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461985
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-11-14 10:50:29 -08:00
Brian Wilkerson 470e8bb751 Documenting our design choices
There are a couple of questions about the design of the analysis
server's features that have come up over the years. I think we want to
capture our decisions and the reasons for them so that we can refer
back to a doc rather than retyping the whole description over and over.
This is an attempt to capture a couple of those topics as a first step.

I'm not completely happy with the structure of the doc. I had originally
thought that I'd have a 'principles' directory to discuss the design
principles we follow, and a 'features' directory to discuss how those
principles are applied to the design of each feature. This initial doc
has both in one file because it wasn't clear how best to split it up.
It's hard to talk about principles in the absence of concrete examples.
I'll probably re-organize the text later, and am hoping you have some
ideas.

By writing this down I'm not trying to stop the discussion of how the
features should be designed. I'm just trying to capture the current
state of the design. Design is, and should be, fluid, and I'm happy to
update these docs as our design changes. So, please review this more
from a perspective of whether the current state is correctly represented
and less from a perspective of whether the current state is what it
ought to be.

Change-Id: I8e3e1de2ca01f3e18fdacc89317ddb0e5a98484e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460904
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-11-12 09:47:29 -08:00
Sam Rawlins 26738fe09d DAS: Use null-aware elements
Change-Id: I15e3b9f8867de3ef651e844cc474119d6c3aea81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454323
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-10-10 11:30:11 -07:00
Sam Rawlins 26102c5d52 DAS plugins: Wire up initial screen for new plugins.
This renames the old screen, "Legacy plugins" and adds a new screen,
"Plugins". On the new plugins screen, we ask the plugins isolate(s) for
their plugins details, and print the following, for eadh plugin:

* the plugin's name
* the names of the registered lint rules
* the names of the registered warning rules
* the IDs and "messages" of the registered assists
* the IDs and "messages" and associated diagnostic codes of the
  registered quick fixes

More to come in follow ups:

* The resolved versions of plugin packages (coming from package_config.json)

Change-Id: Ic3dc4c5bffa64fd4da4097c042a847cc064e41ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447763
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-09-02 08:38:32 -07:00
Brian Wilkerson b385085236 Document the computation of relevance
This is in response to a question asked on an issue with the goal of
making it easier to find the answer in the future.

Change-Id: If434a5e2cda36ba88af3cdf86276203472dca01a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/443902
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-08-06 07:13:51 -07:00
Sam Rawlins ca662a8c49 analyzer: Move the DevExp style guide doc to analysis_server
This is awkward as there are some packages which are co-developed like
analyzer_testing and analyzer_utilities. But broadly speaking, this
style guide is used for the "analysis-related" packages that the Dash
Developer Experience team maintains. So we can move it to live with the
other docs in pkg/analysis_server.

Change-Id: Ic94cfe1d16288ec707c96a42c7a18788e9f8b7d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435220
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-17 12:56:49 -07:00
Kallen Tu 5ccfa844da [analysis_server] Update bullets on language feature checklist.
The bullets on this doc were bugging me because they were confusing which tasks were subtasks of one another. I made them all into checklist bullets (since that's what's most useful for me anyways) and it looks much better.

Change-Id: I593ceb7db5ae39ffda52a2a2e481b1c53a5a7784
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-06-06 11:57:10 -07:00
Danny Tuppeny f3f45a0e88 [analysis_server] Fix some typos in readme/spec
Change-Id: Ifb14293a886eedd0ee868ac43ef18b6224967ac8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427740
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-09 10:03:07 -07:00
Danny Tuppeny fe43c00880 [analysis_server] Add document version support for the legacy server
This adds an optional version number to AddContentOverlay and UpdateContentOverlay in the legacy protocol.

It also moves some code (such as the `Map` that stores the current document versions) from the LSP server into the base class, and updates the overlay handlers to update it.

And finally, it removes the FailingTest() annotations on the versioned EditArguments test since they now work.

Change-Id: Icf2a2825eb6227f5faa3e21ae6c3a7d15997ef5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404821
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-08 09:11:52 -07:00
Brian Wilkerson 07ae3d6159 [cq] Remove the last uses of a comment-based cursor position
Change-Id: Ie5e9c81a6e35cd5da411620dacdbea5429ca454c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414460
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-03-11 14:10:58 -07:00
Sam Rawlins b42700fb21 DAS plugins: Print plugin pub-related crash information to terminal; stop analyzing
Change-Id: Id7f3d9957c52239210029b3b5c3e6f58d96a4d21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413000
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-28 14:38:48 -08:00
Brian Wilkerson 2556d0155c Add documentation for code completion
Change-Id: Ic2954ff86e4fa36ea12e96ffebef6d5621137eb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404522
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-01-15 14:25:28 -08:00
Danny Tuppeny a0b6a489f3 [analysis_server] Allow legacy clients to set LSP capabilities in setClientCapabilities
This adds a new field to the existing (legacy) setClientCapabilities parameters that accepts an LSP ClientCapabilities.

This will allow a legacy client to indicate that it supports things like the `workspace/applyEdit` reverse-request.

Change-Id: Ia3b75c701f1699c92f902e058daec4844ce664fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404106
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-01-14 08:56:41 -08:00
Danny Tuppeny e013a4c9bf [analysis_server] Add some notes on how to use the CPU Profiler for the analysis server hosted by VS Code
Change-Id: I1af51746901d0eb579431c277b0cff204f025c42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-12-02 18:34:38 +00:00
Parker Lougheed b47128dd64 [analysis server] Fix links in implementation docs
Change-Id: Ie40111a6bfed4a6f088f1e7bd3f365aa060a1b0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393700
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-05 19:25:00 +00:00
Danny Tuppeny 75d15bbfa3 [analysis_server] Support formatter page width from analysis_options in legacy protocol
This adds the same support previously added to LSP to the legacy protocol.

As with LSP, the value in analysis_options overrides the explicit argument (since the expectation is that the user has not specifically chosen this value for this file, but rather as a default for the project/globally).

See https://github.com/dart-lang/sdk/issues/56864


[analyzer] Add support for "formatter" in analysis_options + use page_width in LSP

This adds support for validation + completion for `formatter/page_width` in analysis_options, and uses this value in preference to the client-supplied value in the LSP server.

It does not yet add support for the legacy protocol, and there are a few questions in https://github.com/dart-lang/sdk/issues/56864#issuecomment-2399289974.

See https://github.com/dart-lang/sdk/issues/56864

Change-Id: Ic2be00087f78eb62c409dbc8f558d2f24b521f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-08 17:31:46 +00:00
Parker Lougheed a409a1c07d [analyzer/linter] Use shared enumeration for lint names
This helps to avoid any accidental mispellings, enables find usages, and potentially makes future renames easier.

The primary goal is to make future work in https://github.com/dart-lang/sdk/issues/56835 easier.

Change-Id: I684630a4d6cb145031de0dabc221f247246ea00c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388042
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-03 21:36:49 +00:00
Paul Berry 2fe6c5d532 Reorganize analysis server's "new language feature" list and add descriptive text.
Based on discussions for the analysis server implementation of the
wildcards feature (https://github.com/dart-lang/sdk/issues/55681).

Bug: https://github.com/dart-lang/sdk/issues/55681
Change-Id: I8a161ead687ffb71cf18fb573323fbb7c36bf0a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369501
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-06-04 20:51:02 +00:00
Devon Carew 8d6ad53c7e [pkg/analysis_server] remove use of package:usage
Change-Id: I3a18670b6131f4e8c445217f1b302e64a74f591c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365489
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2024-05-07 22:11:29 +00:00
Konstantin Shcheglov 5c07c89a35 Enable 'unnecessary_final' in analysis_server/.
Change-Id: I71ee934b915d4aff924cf5925f87bcc9adc6c015
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362901
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-16 20:04:15 +00:00
Danny Tuppeny dd8c55cc9d [analysis_server] Improve Go-to-Super for constructors and augmentations
This changes Go-to-Super to handle augmentations (jumping to a super-member will go the last augmentation in the chain) and constructors (will jump to the actual super constructor that is called, regardless of name).

Change-Id: I7439fd42ef81983e7a052f250f7ba272fe8c2c86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357608
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-19 21:22:15 +00:00
Danny Tuppeny 28e926f0fb [analyzer]/[analyzer_plugin] Support change descriptions on SourceEdit
Previously, we only had descriptions of changes on a SourceChange. In order to support annotated edits over LSP for "Fix All in Workspace" we need to be able to track descriptions on each change within a file so that if we're fixing multiple different lints with a single SourceFileEdit they can be annotated/grouped in the UI.

In order to avoid every fix providing a description, ChangeBuilder has a field that allows recording the current change description and all builders created from it will use that description when creating their changes. This allows the BulkFixProcessor to set the description on behalf of each fix producer ensuring they all get descriptions (which is done in a follow-up CL along with Fix All in Workspace functionality).

Change-Id: Ie1c508056898bd4000a5505cf59a1e6d35d28da0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356160
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-08 18:54:05 +00:00
Danny Tuppeny c3d80286fe [analysis_server] Add a supportsUris client capability for legacy server to switch into URI mode
This adds support for the legacy server to switch to URIs using a client capability. In this mode, all "FilePaths" will be URI strings over the protocol (in both directions).

It also allows the server to send LSP notifications (wrapped inside an "lsp.notification" notification, matching how requests/responses work). Notifications are automatically enabled if the client uses any LSP methods or sends the new "supportsUris" capability.

Change-Id: I5d2b76e396862129c61de70d57397603c958a02d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349120
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-02-01 22:19:00 +00:00
Brian Wilkerson d45080d365 Remove support for the older legacy completion protocol
This does not remove the computation of available declarations. This CL
seemed big enough without that, so I (or someone else) can get that in
the next CL.

Change-Id: I67ab49b75c8a415ccfaef16c4e49a00026a6091f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341160
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-12-12 00:54:48 +00:00
Danny Tuppeny 82bd6a2e43 [analysis_server] Include extension types in LSP Type Hierarchy
Change-Id: If7a708d1a6f1b4133528fca6786375fffb2560e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324200
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-05 15:41:48 +00:00
Danny Tuppeny ddfc758572 [analysis_server] Expand list of features to review for new language features
I'm not certain all of these could be affected by new language features, but
it seems better to include them and do nothing than potentially miss something.

Change-Id: I4fc74e91511039b6679bc7b72dc3d90a1a45fc30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323661
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-09-01 15:06:49 +00:00
Konstantin Shcheglov bbc3dcbe30 Extension type. Tests for type hierarchy.
Change-Id: Ic0e31bb13efd68a3413429d1ff9110bb9b268e2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323432
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-30 21:18:25 +00:00
Danny Tuppeny 76dc2c4cfa [analysis_server] Change LSP-over-Legacy to be wrapped with the original protocol
Originally we didn't use the LSP Request/Response classes, and just exposed the handlers through the legacy request/response.

However there were some mismatches (such as legacy protocol always returns Map<String, Object?> but some LSP requests return Lists, LSP using int|String IDs, and LSP having numeric error codes that don't match legacy string error codes).

This change uses LSP's request and Response by wrapping them inside a standard (legacy) handler. The LSP-over-Legacy handler has become a standard handler, and the params contain an "lspMessage" field that holds an LSP message, and the result contains an "lspResponse" field that contains an LSP response.

If an LSP handler returns an error, it will be returned as an error inside the LSP response, which will be in a _successful_ legacy request (since that's how we can return an LSP response - as the result).

Change-Id: I67973590ab32f3543d1a6e1b7279974e5e8832bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315201
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-06 14:32:18 +00:00
Konstantin Shcheglov ce7164488a Extension types. Semantic highlighting.
Change-Id: I46cde8151965e209a230df811592f8498e93c218
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318161
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-04 19:13:43 +00:00
Sigmund Cherem cc8b3f792e [analyzer] minor updates to the quick_fix.md documentation
The changes are:
* Use the current tear-off syntax for constuctors in the example
* Add references to the code where certain maps are defined.

Change-Id: I5710090c1ecb2939d74a3822b8c7b35090be378c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304323
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-18 18:53:39 +00:00
Keerti Parthasarathy 261fa6fb3a Wire up argument_type_not_assignable for data driven fixes.
Fix nits in documentation.

Add support for data driven fix for change parameter to non null.


Change-Id: I3120c74eb13e06640aa6ff0b9538e5552f7ae9f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/298261
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-08 22:02:20 +00:00
Brian Wilkerson 2197c81060 Add documentation for data-driven fixes
Let me know if any of this is unclear or if there's missing information.
Of course, you might not know that until you start trying to enhance the
support, but we can also refine the doc when issues are discovered. I'm
mostly just interested in helping you get started.

Change-Id: Ib48a8ce46af7b6cc37a27508c81df03bfd2093e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295040
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-04-14 21:33:50 +00:00
Danny Tuppeny 2ff94f8882 [analysis_server] Allow action in response to showMessageRequest to be null
This allows for users to dismiss a notification without taking any action (something that VS Code / LSP allows for but this API did not).

Change-Id: Icf384008cfcfde6f150c63d3f2889e81e79d1dc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-03-30 19:48:18 +00:00