Closed csells closed 4 years ago
This is an analysis server issue and we should probably track it in the SDK. (In fact, this came up in my editing review too so I should probably just schedule some time to fix it.)
A related issue is: https://github.com/dart-lang/sdk/issues/35831.
/move to dart-lang/sdk
(EDIT: we may not have this bot set up for this repo?)
EDIT2: fyi @bwilkerson @danrubel
@csells, do you still see this issue if you run pub global activate stagehand
? This will get the latest version. I don't see the issue myself locally.
Closing, since we can't reproduce this.
I have just created a new CLI project in VS Code and I get this issue as well.
Some more information: I created a 'Simple Console Application', and right after that, I have a warning in analysis_options.yaml, see the screenshot.
If you do a pub global list
from the command line, you'l be able to see the versions of pub dart tools you have installed. I suspect that you have an older version of stagehand. I'd try a pub global activate stagehand
to get the latest version, create a new project, and be sure to run pub get
after project creation.
$ pub global list
stagehand 3.3.7
After pub global activate stagehand
, the version is still 3.3.7
. pub get
doesn't change anything.
However, as you can see in the screenshot, the underlined 'error source' is wrong, a comment is underscored. When I edit the file (like add a space, remove it and save), it all goes away, and subsequently created projects don't have the issue. What gives? Is it a VS Code issue?
This sounds like an analyzer issue. I've seen things like this happen before (e.g. in DartPad).
/cc @bwilkerson
Yes. IIRC this is a timing issue. If you re-analyze the project, by clicking the "Restart Dart Analysis Server" action in the Problems view, I'm guessing the error goes away?
How should we deal with these kinds of issues? Is there an analyzer bug about them, or should the issue be for the tool (DartPad/IDE)?
I'm a little lost as to what steps cause the problem to either appear or disappear, but if the diagnostic is being reported when there is no problem (or isn't going away when the problem has been fixed), then that's a bug in the analysis server.
I do know that there's a long-standing bug in that the analysis options file doesn't always get re-analyzed when it ought to be (such as after pub
has been run), and that might be the reason for this bug.
I do know that there's a long-standing bug in that the analysis options file doesn't always get re-analyzed when it ought to be
I believe this is the issue.
I'm sure it's been reported but I couldn't find it (though I'm sure this a symptom of the same bug https://github.com/dart-lang/sdk/issues/29198).
Any updates on this?
$ pub global list stagehand 3.3.7
After
pub global activate stagehand
, the version is still3.3.7
.pub get
doesn't change anything.However, as you can see in the screenshot, the underlined 'error source' is wrong, a comment is underscored. When I edit the file (like add a space, remove it and save), it all goes away, and subsequently created projects don't have the issue. What gives? Is it a VS Code issue?
I also noticed same thing Each time i remove the file, the problem goes away but if i include it again, the problem returns
Each time i remove the file, the problem goes away but if i include it again, the problem returns
Yes it happens. And the application run without any error ( without this yaml file ).
I just ran the following commands, and I see no issues. Is there something else I need to do to make the error happen, or has the problem been fixed?
$ mkdir cli_test
$ cd cli_test/
$ pub activate stagehand
$ pub global activate stagehand
$ stagehand console-full
$ pub get
$ dartanalyzer .
$ dart bin/cli_test.dart
I'm using stagehand 3.3.9 and dart 2.9.0 (stable).
The problem I see is when I create a new Dart console app in Visual Studio Code. That's when I see the analyzer error consistently.
The problem I see is when I create a new Dart console app in Visual Studio Code. That's when I see the analyzer error consistently.
Ah, I didn't realize it was a VS Code issue. I tried this in WebStorm, and it's fine.
Who's responsible for VS Code issues?
cc @DanTup
not sure if this is related, but i'm seeing the same error message 'The include file package:pedantic/analysis_options.yaml in [...] cannot be found'. But it's nothing related to stagehand or VS Code 😅️ ..
but what is the difference between dart analyze
and dartanalyzer .
?
➜ $ /usr/local/Cellar/dart/HEAD/libexec/bin/dart analyze
Analyzing kdbx.dart... 1.4s
warning • The include file package:pedantic/analysis_options.yaml in /Users/herbert/dev/kdbx.dart/analysis_options.yaml cannot be found at analysis_options.yaml:1:11 • (include_file_not_found)
1 issue found.
➜ $ /usr/local/Cellar/dart/HEAD/libexec/bin/dartanalyzer .
Analyzing kdbx.dart...
No issues found!
➜ $ /usr/local/Cellar/dart/HEAD/libexec/bin/dart --version
Dart SDK version: 2.10.0-7.0.dev (dev) (Mon Aug 10 22:32:08 2020 +0200) on "macos_x64"
➜ $ /usr/local/Cellar/dart/HEAD/libexec/bin/dartanalyzer --version
dartanalyzer version 2.10.0-7.0.dev
I believe dart analyze
and dartanalyzer
are the same. We're transitioning away from requiring specialized commands like dartanalyzer
, toward having everything accessible from the dart
command (like the flutter
command).
If this only happens in VS Code, my guess would be that it could be due to the timing/order of things - we create a folder, start the server, set the analysis roots, then run stagehand. We can probably change this to delay setting the analysis roots when project creation is process to workaround the issue, though it's probably worth first seeing if we can make the server handle it better. I'll take a look and see if I can figure out why it doesn't work.
That said - that wouldn't explain the comment above from @hpoul showing the error when running dart analyze
but not dartanalyzer
(assuming both commands were run after the packages were fetched with pub get
).
You can think of dartanalyzer
as an older version of dart analyze
; dartanalyzer
doesn't do things like analyze the analysis_options.yaml file.
dartanalyzer
doesn't do things like analyze the analysis_options.yaml file.
I guess that explains why dartanalyze
does not show the warning 😅️ - does this mean it doesn't look at the analysis_options.yaml
file for analysis configuration at all, or it doesn't analyse the file analysis_options.yaml
itself for errors?
I also can't repro this with Dart v2.9.0 (though I think I'd seen this in the past).
For anyone that can repro this, can you confirm the SDK version and enable the analysis server instrumentation log in VS Code and attach the log? (don't forget to disable the logging afterwards). This might give an idea of the order/timing of analysis and the creation of the analysis_options/package files.
sorry for the noise, but I think I found my (unrelated?) problem. I have a package with a nested example
project. The example project does not have a analysis_options.yaml
and also no dependency on pedantic
. As long as I don't pub get
the example
project, everything is fine, after running pub get
in the example project, running dart analyze
in the parent project I get the warning "The include file package:pedantic/analysis_options.yaml in /Users/herbert/dev/kdbx.dart/analysis_options.yaml cannot be found". After adding an empty analysis_options.yaml
to the example/
subdirectory or adding the pedantic
dev_dependencies to the subproject, the warning disappears. So I guess it would just helpful for dart analyze
to show for which project the warning actually belongs to :) and not just the path to the analysis_options.yaml
Here's the order of things happening in a log from @csells:
// Set analysis roots - this happens before `pub get` has run, and generates the diagnostic
1598306968673:Req:{"id"::"3","method"::"analysis.setAnalysisRoots","params"::{"excluded"::[],"included"::["/Users/foo/bugs/foo"]},"clientRequestTime"::1598306968601}
1598306969081:Noti:{"event"::"analysis.errors","params"::{"file"::"/Users/foo/bugs/foo/analysis_options.yaml","errors"::[{"severity"::"WARNING","type"::"STATIC_WARNING","location"::{"file"::"/Users/foo/bugs/foo/analysis_options.yaml","offset"::10,"length"::38,"startLine"::1,"startColumn"::11},"message"::"The include file package::pedantic/analysis_options.yaml in /Users/foo/bugs/foo/analysis_options.yaml cannot be found.","code"::"include_file_not_found","hasFix"::true}]}}
// Initial analysis runs
1598306969233:Noti:{"event"::"server.status","params"::{"analysis"::{"isAnalyzing"::true}}}
1598306971997:Noti:{"event"::"server.status","params"::{"analysis"::{"isAnalyzing"::false}}}
// Pub get runs and triggers analysis, but error is not cleared
1598306974224:Watch:/Users/foo/bugs/foo:/Users/foo/bugs/foo/pubspec.lock:add
1598306974313:Watch:/Users/foo/bugs/foo:/Users/foo/bugs/foo/.packages:add
1598306974504:Noti:{"event"::"server.status","params"::{"analysis"::{"isAnalyzing"::true}}}
1598306974515:Watch:/Users/foo/bugs/foo:/Users/foo/bugs/foo/.dart_tool/package_config.json:add
1598306977487:Noti:{"event"::"server.status","params"::{"analysis"::{"isAnalyzing"::false}}}
I thought it should be easy to reproduce this - however I can't actually trigger the error at all. I created a new project, deleting all dependencies from the pubspec, deleted .dart_tool
, .packages
and pubspec.lock
- however I still don't get a warning in the analysis_options file telling me it can't find that include! I've tried with stable Dart v2.9.0 and yesterdays nightly.
I can repro now - apparently we don't generate this diagnostic when using the LSP server (which I have on by default) so it never showed up (I'll look at that too). It turns out to be fairly easy to reproduce by just deleting .packages
/.dart_tool
and reloading - that will generate the warning, then you can run pub get
while the analysis server is running and it won't clear the error.
Working on fixes:
Original issue: https://dart-review.googlesource.com/c/sdk/+/160068/ LSP server: https://dart-review.googlesource.com/c/sdk/+/160070/
This is fixed by https://github.com/dart-lang/sdk/commit/b613265c8573dfa0916e05befa3c953fcd6f1303 and should be testable in the latest nightly.
(I don't have permissions to close issues here though, so someone else will need to)
Thanks, @DanTup!
''warning: The include file package:pedantic/analysis_options.yaml in C:\Agora-Flutter-Quickstart-master\analysis_options.yaml cannot be found. (include_file_not_found at [agora_flutter_quickstart] analysis_options.yaml:1)''
Hello guy's , my name is hemil , I am new on flutter , I'm in my under graduation course final year , I am trying to make video call app in flutter , I use Agora-Flutter-Quickstart code to test it but i found upper warning how can i fix this, this is the link of code:-https://github.com/AgoraIO-Community/Agora-Flutter-Quickstart.
i also found this error when i start the v call .
I still have this error. In a fresh project, the error appears in VSCode whenever I run webdev build
the error appears that the include file package cannot be found.
I have already activated stage hand.
It seems that restarting VSCode or running pub get
are the only ways to fix this error. Is this normal behavior? Is it an issue separate from stagehand (ie VSCode dart extension or something else)?
@jmahlers if it happens when running webdev build
it's likely an analysis server issue rather than either Stagehand or VS Code. Can you file an issue at https://github.com/dart-lang/sdk with steps on how to reproduce this (including your SDK version and the steps to set a project up to reproduce this)? Thanks!
The following line of code from the template:
causes an error with no good guidance for each new Dart CLI app project: