8e1751f4ce
These are on by default but can be toggled in the client with the "dart.codeLens" setting, either by disabling entirely:
```
"dart.codeLens": false
```
Or individually
```
"dart.codeLens": {
"augmented": false,
"augmentation": false,
}
```
They require a client-provided command to handle the navigation, so this also adds a "commands" section to the client capabilities (in "experimental", because that's the extension point for non-standard LSP) that allows the client to inform the server that it handles such a command (which is documented in the readme and implemented in Dart-Code in https://github.com/Dart-Code/Dart-Code/commit/ebe029c3f9aca724d386b3da10f414f624bc705a).
Change-Id: I91791c9f4aa5957c4ab4b9c0c5bb4fcf8ebeb717
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359640
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
29 lines
710 B
Dart
29 lines
710 B
Dart
import 'package:analysis_server/lsp_protocol/protocol.dart';
|
|
|
|
extension RangeExtension on Range {
|
|
/// Checks whether the range covers [position] (inclusive).
|
|
bool containsPosition(Position position) {
|
|
// On an earlier line.
|
|
if (position.line < start.line) {
|
|
return false;
|
|
}
|
|
|
|
// On start line, but before start character.
|
|
if (position.line == start.line && position.character < start.character) {
|
|
return false;
|
|
}
|
|
|
|
// On end line, but after end character.
|
|
if (position.line == end.line && position.character > end.character) {
|
|
return false;
|
|
}
|
|
|
|
// On a later line.
|
|
if (position.line > end.line) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|