Skip to content

Linting for when a backtick is followed only by white space #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AndrewGaspar opened this issue Jan 6, 2016 · 3 comments
Closed

Linting for when a backtick is followed only by white space #69

AndrewGaspar opened this issue Jan 6, 2016 · 3 comments

Comments

@AndrewGaspar
Copy link

I've been bitten by this bug a few times:

$oven = Toast-Bread ` 
    -Bread Wheat

You probably can't see the problem - there's a space after the backtick, which causes the parser not to take the next line as part of the command, causing the command to be issued without the Bread parameter. It would be great if vscode-powershell highlighted this issue because I'm sure it's almost never done intentionally.

This seems to be a PowerShell problem generally - why isn't a backtick followed only by white space and a newline handled the same as a backtick immediately followed by a newline?

@rkeithhill
Copy link
Contributor

This extension pulls in the PSScriptAnalyzer as a submodule to do all the linting. It is a reasonable suggestion but you should probably file the bug on that project.

BTW you might think about setting this user preference in VSCode (I do):

// When enabled, will trim trailing whitespace when you save a file.
"files.trimTrailingWhitespace": true

@AndrewGaspar
Copy link
Author

Sounds good. Moved to PSScriptAnalyzer. Thanks for the suggestion!

@daviwil
Copy link
Contributor

daviwil commented Jan 6, 2016

Ideally the PS parser would either accept this syntax or give a helpful error, but the next best thing is a Script Analyzer rule. Thanks for filing this over there!

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

No branches or pull requests

3 participants