Comments (5)
from sdk.
Some quick debugging shows that there are no drivers in driversMap when empty data[] is returned, but there is driver when it starts to show up:
from sdk.
Creating the analysis roots is async, so at the time the request is being handled they probably haven't been set up yet.
Probably the fix will be something like changing this direct call to server.getResolvedUnit()
:
To instead use requireResolvedUnit
which wraps it, but in the case where context roots are being set up, will wait for them to complete:
sdk/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart
Lines 207 to 215 in 43fa0e0
That method treats errors slightly differently though so it might need a little tweaking to ensure requests for semantic tokens for non-Dart files or files that legitimately aren't analyzed are handled correctly.
from sdk.
Indeed this dirty fix helped. Thanks! (not sure how to make it better so that it can be merged, so just leaving here for now).
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_semantic_tokens.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_semantic_tokens.dart
index 1a0e4da212d..740df9aaea5 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_semantic_tokens.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_semantic_tokens.dart
@@ -32,8 +32,11 @@ abstract class AbstractSemanticTokensHandler<T>
Future<List<SemanticTokenInfo>> getServerResult(
String path, SourceRange? range) async {
- var result = await server.getResolvedUnit(path);
- var unit = result?.unit;
+ var result = await requireResolvedUnit(path);
+ if (result.isError) {
+ return [];
+ }
+ var unit = result.resultOrNull?.unit;
if (unit != null) {
var computer = DartUnitHighlightsComputer(unit, range: range);
return computer.computeSemanticTokens();
from sdk.
Related Issues (20)
- Unexpected non-zero index in CalculateElementAddressInstr HOT 3
- Removed unnecessary dependencies from `ddc_stable_test` and `ddc_canary_test`
- Divergent execution with Float32x4 HOT 4
- Macros: Static types are broken HOT 4
- Function.toJS uses static type for type casts on dart2wasm but runtime type for type casts on dart2js/ddc.
- Analyzer and compiler should call out when a getter doesn't exist but a setter does
- "dart run dart2wasm.dart" broken HOT 2
- DDC should move away from using JS default arguments for Dart methods with default parameters
- data transfer between two socket using pipe not working correctly HOT 2
- HttpResponse.addStream does not forward cancelation HOT 4
- [analyzer_plugin]: Add a way to react to `VSCode source.fixAll`
- Unhandled exception in CFE at spurious type parameter list HOT 1
- [CP] Check dart:ffi imports and wasm:import/export pragmas in user code HOT 5
- [dart2js] Error messages no longer appearing when running apps in Chrome HOT 2
- [Macros] ClassTypeBuilder.declareType with mixin crashes the dart analysis server in vscode
- [ddc] Error messages no longer appearing when running apps in Chrome HOT 1
- [CP] [dart2wasm] Make `dart compile wasm` accept --enable-experiment flags and pass those to compiler HOT 4
- [CP] [dart2wasm] Only share type parameter fields if nullability allows HOT 2
- Path and FileSystemEntity in Dart HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk.