Closed ghost closed 5 years ago
Hi, @runedrune ! This plugin works by finding the pubspec.yaml file in the root of the project you opened. It does that to find out your project name. Make sure you have actually opened your root folder on VSCode.
This seems to be the actual error:
Expected line 'name:' on pubspec.yaml to match regex, but it didn't (line: name: jaiza ).
Not sure what's wrong. It was working before.
The Regex it's trying to match is this: /^\s*name:\s*(.*)$/
Maybe there is something unexpected inside your pubspec file...
I suspect it's a trailling space, please check your pubspec file, according to the error message there is an extra space after your project name.
However upon quick check of the regex it doesn't look like it should matter much; so, in case the error persist, could you please send the file so we can understand what's the issue?
Strange. I've checked everything. Maybe I'm missing something right in front of me. Here's the complete file:
name: jaiza
description: A flutter app to access the Jamaat e Islami Jaiza website.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
intl: ^0.15.7
http: ^0.12.0
firebase_messaging: ^3.0.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/logo.png
Hi, I had a theory it had to do with dangling /r characters from your operating system. I released a new version, 0.1.1, please take a look and see if it's a fix :)
Well the error changed after updating to 0.1.1.
Current file is not on project root or not on lib folder? File must be on $root/lib.
But it is in the lib folder.
So that worked out (the first problem). Probably it was a dangling character like a /r or non-printable-character at the end of that line in your pubspec file. Some OS's like to add those stuff, I'd suggest you to take a look at the ascii characters in your file to be sure if you want to dig into that.
But that's solve, now there is another problem. This error I supposed shouldn't happen, because it's saying that your file is not in the same folder as your pubspec file (or children), because it's matching the path with startsWith.
So I released a 0.1.2 version with a better error message. It won't fix it, but maybe we will learn will by printing in the error both paths.
Could you please update and send me the new error message?
Current file is not on project root or not on lib folder? File must be on $root/lib. Your current file path is: 'c:\Users\Fawad Khan\Documents\Flutter Projects\jamaat_e_islami_app\lib\tables\selectparticipants.dart' and the lib folder according to the pubspec.yaml file is 'c:\Users\Fawad Khan\Documents\Flutter Projects\jamaat_e_islami_app\pubspec.yaml/lib'.
Oh, I see the problem. It seems you are using Windows, and therefore the extension will not be able to process file paths correctly, because windows for some reason uses inverted separators for file paths... That also explains it adding weird \r characters to the end of the lines, which caused the problem with the regex earlier.
I believe there is a way in node to use the path module to construct the file paths in a way that's independent of the PATH_SEPARATOR. I'm not sure if it's available within vscode extension environment, but it believe it might.
It will, however, require changes in all the code that handles path to consider the case to have a weird path separator.
Would you like to contribute with a PR? I'd be glad to merge this feature to make it work on Windows systems!
Closing in favor of #6
keep getting this error when trying to run the extension:
my flutter doctor result: