-
Notifications
You must be signed in to change notification settings - Fork 303
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
Create missing override(s) quickfix not showing for empty classes. #4184
Comments
Thanks, I can reproduce this. Something seems odd with the edits being produced, there's a selection from 0-27 in the edit, which covers the range {
"message": "Create 2 missing overrides",
"edits": [
{
"file": "/Users/danny/Dev/TestStuff/flutter_counter/lib/dc4184.dart",
"fileStamp": 0,
"edits": [
{
"offset": 74,
"length": 0,
"replacement": "\n @override\n void paint(Canvas canvas, Size size) {\n // TODO: implement paint\n }\n\n @override\n bool shouldRepaint(covariant CustomPainter oldDelegate) {\n // TODO: implement shouldRepaint\n throw UnimplementedError();\n }\n"
}
]
}
],
"linkedEditGroups": [
{
"positions": [
{
"file": "/Users/danny/Dev/TestStuff/flutter_counter/lib/dc4184.dart",
"offset": 100
}
],
"length": 6,
"suggestions": [
{
"value": "Canvas",
"kind": "TYPE"
},
{
"value": "Object",
"kind": "TYPE"
}
]
},
{
"positions": [
{
"file": "/Users/danny/Dev/TestStuff/flutter_counter/lib/dc4184.dart",
"offset": 107
}
],
"length": 6,
"suggestions": []
},
{
"positions": [
{
"file": "/Users/danny/Dev/TestStuff/flutter_counter/lib/dc4184.dart",
"offset": 115
}
],
"length": 4,
"suggestions": [
{
"value": "Size",
"kind": "TYPE"
},
{
"value": "OffsetBase",
"kind": "TYPE"
},
{
"value": "Object",
"kind": "TYPE"
}
]
},
{
"positions": [
{
"file": "/Users/danny/Dev/TestStuff/flutter_counter/lib/dc4184.dart",
"offset": 120
}
],
"length": 4,
"suggestions": []
},
{
"positions": [
{
"file": "/Users/danny/Dev/TestStuff/flutter_counter/lib/dc4184.dart",
"offset": 205
}
],
"length": 13,
"suggestions": [
{
"value": "CustomPainter",
"kind": "TYPE"
},
{
"value": "Listenable",
"kind": "TYPE"
},
{
"value": "Object",
"kind": "TYPE"
}
]
},
{
"positions": [
{
"file": "/Users/danny/Dev/TestStuff/flutter_counter/lib/dc4184.dart",
"offset": 219
}
],
"length": 11,
"suggestions": []
}
],
"selection": {
"file": "/Users/danny/Dev/TestStuff/flutter_counter/lib/dc4184.dart",
"offset": 74
},
"selectionLength": 27,
"id": "dart.fix.create.missingOverrides"
} |
Oh ok, so this is a problem with Thanks for looking into it :) |
@pitriq it's not specific to I've tracked down the cause (and found a few similar related issues) and just working on some tests. The issue is in the Dart SDK, so the fix will ultimately ship with an SDK update rather than a Dart-Code update. |
…dditional edits are made This fixes a few minor issues: - Setting a new selection position did not remove a previously set selection range (which could result in a mismatched offset/length due to how the resulting change merges the position/range) - Setting a new selection range did not update a previously set selection position - Inserting new changes before a change that sets a selection range only updated the selection position, not selection range - Setting a selection range/position after another change that inserts only updated the selection position to compensate and not the selection range These issues led to cases where selection ranges could be incorrect, or even overlap with linked edit groups that could cause errors that caused code action requests to fail. Fixes Dart-Code/Dart-Code#4184 Change-Id: I43e2a8361c97b2eccb2d6b426a75eda5cc811e06 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261682 Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Fixed by dart-lang/sdk@d97c3e8. Will ship in a future Dart SDK. |
Describe the bug
When creating an empty class that
extends
another one, the "Create n missing override(s)" quickfix is not appearing. In fact vscode says there are no quickfixes available at all. Once I write a single character inside the class, quickfixes start showing up.This does not happen when using
implements
.I'm not sure whether this is an extension or a language server issue. Feel free to close this and refer me to the correct repo.
To Reproduce
Steps to reproduce the behavior:
cmd+.
anywhere in the class name.Expected behavior
It should display the appropriate quickfixes.
Screenshots
Please complete the following information:
These are the the logs of pressing
cmd+.
on the empty class' name, captured with Dart: Capture Analysis Server Logs.Details
!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!
Dart Code extension: 3.49.20220926
Flutter extension: 3.48.0 (activated)
App: Visual Studio Code
Version: 1.71.2
Platform: mac
Workspace type: Flutter
Analyzer type: LSP
Multi-root?: true
Dart SDK:
Loc: LOCATION
Ver: 2.18.1
Flutter SDK:
Loc: LOCATION
Ver: 3.3.2
HTTP_PROXY: undefined
NO_PROXY: undefined
Logging Categories:
General, Analyzer, CommandProcesses
Tue Sep 27 2022 [10:19:46 GMT-0300 (Argentina Standard Time)] Log file started
[10:19:57 AM] [Analyzer] [Info] ==> Content-Length: 742
[10:19:57 AM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":49,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"FILE_URI"},"range":{"start":{"line":2,"character":8},"end":{"line":2,"character":8}},"context":{"diagnostics":[{"range":{"start":{"line":2,"character":6},"end":{"line":2,"character":9}},"message":"Missing concrete implementations of 'CustomPainter.paint' and 'CustomPainter.shouldRepaint'.\nTry implementing the missing methods, or make the class abstract.","code":"non_abstract_class_inherits_abstract_member","codeDescription":{"href":"file:///diagnostics/non_abstract_class_inherits_abstract_member"},"severity":1,"source":"dart"}],"triggerKind":1}},"clientRequestTime":1664284797019}
[10:19:57 AM] [Analyzer] [Info] <== Content-Length: 126
Content-Type: application/vscode-jsonrpc; charset=utf-8
[10:19:57 AM] [Analyzer] [Info] <== {"id":49,"jsonrpc":"2.0","error":{"code":-32001,"message":"An error occurred while handling textDocument/codeAction request"}}
[10:19:57 AM] [Analyzer] [Info] <== Content-Length: 2800
Content-Type: application/vscode-jsonrpc; charset=utf-8
{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"An error occurred while handling textDocument/codeAction request: RangeError (end): Invalid value: Not in inclusive range 27..232: 26\n#0 RangeError.checkValidRange (dart:core/errors.dart:363:9)\n#1 _StringBase.substring (dart:core-patch/string_patch.dart:400:27)\n#2 SnippetBuilderExtensions.appendPlaceholders (package:analysis_server/src/lsp/snippets.dart:332:23)\n#3 _buildSnippetString (package:analysis_server/src/lsp/snippets.dart:135:7)\n#4 buildSnippetStringForEditGroups (package:analysis_server/src/lsp/snippets.dart:26:5)\n#5 snippetTextEditFromEditGroups (package:analysis_server/src/lsp/mapping.dart:928:14)\n#6 toSnippetTextEdits (package:analysis_server/src/lsp/mapping.dart:1508:22)\n#7 createWorkspaceEdit (package:analysis_server/src/lsp/mapping.dart:150:24)\n#8 CodeActionHandler._createFixAction (package:analysis_server/src/lsp/handlers/handler_code_actions.dart:226:13)\n#9 CodeActionHandler._getFixActions. (package:analysis_server/src/lsp/handlers/handler_code_actions.dart:423:30)\n#10 MappedListIterable.elementAt (dart:_internal/iterable.dart:413:31)\n#11 ListIterator.moveNext (dart:_internal/iterable.dart:342:26)\n#12 List.addAll (dart:core-patch/growable_array.dart:319:13)\n#13 CodeActionHandler._getFixActions (package:analysis_server/src/lsp/handlers/handler_code_actions.dart:421:23)\n\n#14 OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:164:18)\n\n#15 Future.wait. (dart:async/future.dart:522:21)\n\n#16 CodeActionHandler._getCodeActions (package:analysis_server/src/lsp/handlers/handler_code_actions.dart:350:21)\n\n#17 OperationPerforma…
Tue Sep 27 2022 [10:20:02 GMT-0300 (Argentina Standard Time)] Log file ended
The text was updated successfully, but these errors were encountered: