Skip to content

Commit 015f872

Browse files
DanTupCommit Queue
authored andcommitted
[analysis_server] Add an LSP handler for editing argument values
This adds basic editing for the argument types supported by `textDocument/editableArguments`. It doesn't currently attempt to format code currently (or use multiline/raw strings where they might be more appropriate), and does not allow arbitrary values that don't match the type for the parameter. Change-Id: Ied95d95c0de39310aef0a1153864e902d56e1910 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395280 Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Elliott Brooks <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent c1e04fc commit 015f872

File tree

11 files changed

+1285
-6
lines changed

11 files changed

+1285
-6
lines changed

pkg/analysis_server/lib/src/lsp/constants.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ abstract final class CustomMethods {
160160
'experimental/dart/textDocument/editableArguments',
161161
);
162162

163+
/// Method for adding/editing an argument at a location in a document.
164+
static const dartTextDocumentEditArgument = Method(
165+
'experimental/dart/textDocument/editArgument',
166+
);
167+
163168
// TODO(dantup): Remove custom AnalyzerStatus status method soon as no clients
164169
// should be relying on it as we now support proper $/progress events.
165170
static const analyzerStatus = Method(r'$/analyzerStatus');

pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/editable_arguments_mixin.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ typedef EditableInvocationInfo =
2121
int numSuppliedPositionals,
2222
});
2323

24-
/// A mixin that provides functionality for locating arguments and associated
25-
/// parameters in a document to allow a client to provide editing capabilities.
2624
mixin EditableArgumentsMixin {
27-
/// Gets information about an invocation at [offset] in [result] that can be
28-
/// edited.
25+
/// Gets the argument list at [offset] that can be edited.
2926
EditableInvocationInfo? getInvocationInfo(
3027
ResolvedUnitResult result,
3128
int offset,

0 commit comments

Comments
 (0)