Comments (8)
@DanTup fyi
from sdk.
@incendial I don't seem to be able to reproduce. The fixes run (the backslashes are removed), but no errors:
Recording.2024-03-04.143530.mp4
Can you reproduce in a new project, or only a specific one? Could you show a list of all the diagnostics you see for this file (and which fixes appear for each of the diagnostics)? It seems like we're trying to use both a FileEditBuilder
and DartFileEditBuilder
on the same file but I'm not sure which fix the FileEditBuilder
is coming from.
from sdk.
btw, looks like I don't have any diagnostics on the last line which might be why I'm not triggering it - I presume if removing that line fixes it, you might have a diagnostic/fix showing up for it?
from sdk.
Can you try enabling "use_raw_strings"?
from sdk.
Aha, that triggers it. Thanks!
from sdk.
@bwilkerson this is happening because the fixes use a mix of generic and Dart file builders. If there is a fix using each in the same file it results in this error when trying to fix both (both for the LSP server's "fix all" and dart fix
).
For example remove_unnecessary_string_escapes
uses the generic builder:
But convert_to_raw_string
uses a Dart builder:
I thought the right fix would be for the fixes to always use Dart edit builders and we should change the interface so they can't accidentally create other kinds of edit builders. However, we have a fix "Ignore diagnostic in analysis_options.yaml" which is a Dart fix but edits a non-Dart file and I realise that's not quite right.
One possibility would be to have addGenericFileEdit()
return a Dart edit builder if called for a Dart file - however a Dart edit builder is not currently a superclass of a generic edit builder. So another option could be to just remove addGenericFileEdit
entirely and force all code through a specific edit builder (Dart or YAML, and if we have other file types, make more specifically-named methods for each of them).
Any thoughts/opinions?
from sdk.
Maybe a slightly simpler idea: add an assert to addGenericFileEdit
to ensure it's not called for Dart or YAML files. As long as all callers have some test it should avoid this happening accidentally (but avoids having to make a breaking API change).
I opened https://dart-review.googlesource.com/c/sdk/+/355441 along these lines.
from sdk.
For example
remove_unnecessary_string_escapes
uses the generic builder
That's definitely a bug. The fix clearly only applies to Dart files.
Maybe a slightly simpler idea: add an assert to
addGenericFileEdit
to ensure it's not called for Dart or YAML files.
I like that idea.
from sdk.
Related Issues (20)
- textDocument/completion payload sizes can be very large because of documentation of in-scope items HOT 7
- Dart cannot open a socket on Android device, not simulator HOT 6
- stdin stream closes unexpectedly when Dart program is spawned from a bat file (which is spawned by a NodeJS process) and an msys2 program has been run earlier in the bat file HOT 1
- vm/cc/DartAPI_BreakpointLockRace flaky -> Timeout on vm-linux-debug-x64c HOT 1
- Crash on new ffi/msan_test on ARM64 MSAN configurations
- Set-Cookie path should not be case-insensitive
- Provide a compatible method to conditionally import between WASM and regular Web with also backward compatibility HOT 5
- [resource_identifiers] closures out of static functions
- pkg/json breaks when a field name contains $ HOT 2
- [vm/ffi] `Pointer.asTypedList` shared across isolates causes use after free
- WASM incorrectly advertises dart.library.js HOT 2
- CFE fails to notice record field name differences when performing subtype matches HOT 1
- extension type on a Function named call HOT 7
- Invalid fixes being suggested
- Add a fix to create an extension method
- How should I load JS libraries from within WASM? HOT 2
- Macros: Failure to compile redirecting factories HOT 2
- [resource_identifiers] Rename to recorded_references. HOT 1
- [native_assets][resource_identifiers] Deferred loading and assets HOT 2
- Dart WebSocket Connection to webserver Exhibits Inconsistent Behavior and Premature Closure HOT 3
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.