Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Do not run Vale on out-of-workspace files when ${workspaceFolder} is used in settings. #44

Conversation

jvilk-stripe
Copy link
Contributor

Hey all! This is my first contribution to this project. Please let me know if you need me to make any changes.

Do not run Vale on out-of-workspace files when ${workspaceFolder} is used in settings.

Fixes a bug where Vale throws multiple errors whenever you do this.

Problem

If you configure a ${workspaceFolder}-relative path to vale.ini and open a Markdown file that is outside of the current workspace, Vale displays the following errors:

There was an error running Vale TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type undefined.
[Vale]: '${workspaceFolder}/docs/vale/.vale.ini' does not exist.

Expected Behavior

Vale should silently ignore any files that are not part of the current workspace.

Reproducing

I've put together a workspace that demonstrates the issue. README.md details how to reproduce.

https://drive.google.com/file/d/17Jje6njhzFVfFdTPdosARIjf6a__7Pw_/view?usp=sharing

…used in settings.

Fixes a bug where Vale throws multiple errors whenever you do this.
@ChrisChinchilla
Copy link
Collaborator

Thanks @jvilk-stripe I generally find that if I have a workspace defined and attempt to open a file from outside of it, then the file opens in a new window, but maybe that's my settings. However, I did test this by manually dragging a file into a workspace folder and seeing what happens, and this does fix the issue you describe.

However, I wonder if a better user experience might be telling the user that Vale is not checking this file somehow? Perhaps using the output console (#38), or some other way?

As if Vale just doesn't test the file, people might be equally as confused?

@jvilk-stripe
Copy link
Contributor Author

Good idea; done! It now outputs the following:

Screen Shot 2021-01-04 at 9 01 22 AM

@jvilk-stripe
Copy link
Contributor Author

(I'm open to improvements to the message, too, if you have any. :) )

@jdkato
Copy link
Member

jdkato commented Jan 4, 2021

This looks good to me, but I'll let @ChrisChinchilla do the merge since I haven't reviewed all that closely.

@ChrisChinchilla
Copy link
Collaborator

Looks good to me @jvilk-stripe

@ChrisChinchilla ChrisChinchilla merged commit f568f57 into errata-ai:master Jan 5, 2021
@jvilk-stripe jvilk-stripe deleted the jvilk/fix-out-of-workspace-files branch January 5, 2021 16:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants