Initialize Flat YML gives me error
Closed this issue ยท 10 comments
Hi @aborruso. Are you able to link to the repo for which you're seeing this issue?
Hi @aborruso. Are you able to link to the repo for which you're seeing this issue?
It's this https://github.com/aborruso/flat_data_bash_example
Thank you
In the interim, can you tell me if you see any errors/messages in either the Output or Debug Console when you encounter this issue on your machine?
I have nothing.
The full errors is
Command 'Flat Editor: Initialize Flat YML File' resulted in an error (Running the contributed command: 'flat.initializeFlatYml' failed.)
Bummer! Can you help me understand what might have happened between #10 and now? It looks like the webview loaded fine beforehand? Did anything in your environment change?
Bummer! Can you help me understand what might have happened between #10 and now? It looks like the webview loaded fine beforehand? Did anything in your environment change?
Nothing has changed: since "Initialize Flat YML" doesn't work, I simply create it using "new file".
Hey @mattrothenberg
I've just experienced the same issue as @aborruso.
I've documented the error that occurs, what the root cause seems to be, a workaround for others that experience this, and steps on how to reproduce it on Windows.
Later this week/next week I can try to submit a PR if you like. I haven't done it yet as whilst the change suggested below worked okay in my brief testing it may not be the right thing to do, especially for non-Windows environments which I currently don't have access to.
Cheers
echdata
Error
-
It is failing on the call to
fs.mkdirSync
atLine 75 in c060969
-
The error thrown is
Error: ENOENT: no such file or directory, mkdir '\c:\Development\Repos\flat-editor-testing\.github\workflows'
-
It appears (tbc) to fail because when the
workflowsDir
path is constructed the extension is usingrootPath.uri.path
which ultimately results in a path like\\c:\\Development\\Repos\\flat-editor-testing\\.github\\workflows
being sent tofs.mkdirSync
-
Changing
workflowsDir
to userootPath.uri.fsPath
instead a few lines up at/src/extension.ts#L64
results in a better formedc:\\Development\\Repos\\flat-editor-testing\\.github\\workflows
which succeeds when passed tofs.mkdirSync
Workaround
- Manually create a new file relative to workspace root at
/.github/workflows/flat.yml
- The Flat Editor extension will pick this up and allow editing through the UI ๐
Steps to Reproduce
Steps
- Install Flat Editor https://marketplace.visualstudio.com/items?itemName=GitHubOCTO.flat
- Create an empty directory at
c:\development\repos\flat-editor-testing\
- Open the folder in VS Code
- Open VS Code Command Pallete
- Type
Initialize FLAT
- Run the
Flat Editor: Initialize Flat YML File
- See Expected Behavior
Expected
- A new file will be created relative to workspace root at
/.github/workflows/flat.yml
- VS Code will open the
flat.yml
with the default flat stub
Actual
- VS Code errors out with error
Command 'Flat Editor: Initialize Flat YML File' result in an error (Running the contributed command: 'flat.initializeFlatYml' failed.)
- The file and directories are not created or opened
- No error is printed to console and no other VS Code info message is shown
- Stepping through shows the error is
Environment
Device
Version: 1.59.0 (user setup)
Commit: 379476f0e13988d90fab105c5c19e7abc8b1dea8
Date: 2021-08-04T23:13:12.822Z
Electron: 13.1.7
Chrome: 91.0.4472.124
Node.js: 14.16.0
V8: 9.1.269.36-electron.0
OS: Windows_NT x64 10.0.19042
Extension
Name: Flat Editor
Id: githubocto.flat
Description: An editor for flat-data configurations
Version: 0.20.0
Publisher: GitHub OCTO
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=GitHubOCTO.flat
Flat Editor Install Link: https://marketplace.visualstudio.com/_apis/public/gallery/publishers/GitHubOCTO/vsextensions/flat/0.20.0/vspackage
Thanks @echdata , we'd welcome a PR!
still experiencing this issue, has @echdata's PR been merged?
I've used a workaround to create the file manually, however the GUI isn't loading.
Just published 0.22.0
โ it should be available via the VSCode Marketplace momentarily. Please upgrade and let me know (via a new issue) if you run into any trouble.