Skip to content

Conversation

@keraion
Copy link
Contributor

@keraion keraion commented Jul 14, 2024

This defaults the workspace path to the current working directory when vscode is running without a workspace.

Comment on lines +128 to 130
const rootPath = workspaceFolder ? Utilities.normalizePath(workspaceFolder) : Utilities.normalizePath(".");
const workingDirectory = workspacePath ?? Configuration.workingDirectory(rootPath);
const filePath = document && !document.isUntitled ? Utilities.normalizePath(document.fileName) : workingDirectory;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the issue might actually be the filePath should be using the document.fileName, but for some reason the document.isUntitled is true sometimes in workspaceless instances even though the file has a filename. I am going to update this to instead check document.fileName.

This change will be released in v3.1.2, let me know if there are still issues and I can look into it further.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is an ok solution, my only concern is the --stdin-filename path becomes something like sqlfluff lint --format json --stdin-filename ../../../../../path/to/vscode/Untitled-1 -. By itself, this is fine as it will pick up the workspace's root .sqlfluff file but could have unintended side effects if any additional .sqlfluff files exist on that path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"File path not found" when working on unsaved files

2 participants