Skip to content
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

Fix document highlight column #1279

Merged

Conversation

TylerLeonhardt
Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Apr 30, 2020

fixes PowerShell/vscode-powershell#305

We were originally computing the location by doing:

ast.Extent.Text.IndexOf(ast.Name)

but this is horrible because of cases like function func { } which break it... and not to mention it doesn't include the space before the definition... aka indentation.

Since the AST doesn't tell us where the actual name of the function starts, we need to compute it.

@TylerLeonhardt TylerLeonhardt requested a review from rjmholt May 1, 2020 18:10
@TylerLeonhardt
Copy link
Member Author

Ok last commit adds:

Support for silly functions like this:
image

and tests 🎉

@TylerLeonhardt
Copy link
Member Author

Codacy Here is an overview of what got changed by this pull request:

Complexity increasing per file
==============================
- test/PowerShellEditorServices.Test/Services/Symbols/AstOperationsTests.cs  2
- test/PowerShellEditorServices.Test.E2E/LanguageServerProtocolMessageTests.cs  1
         

See the complete overview on Codacy

@TylerLeonhardt TylerLeonhardt merged commit d54bda7 into PowerShell:master May 1, 2020
@TylerLeonhardt TylerLeonhardt deleted the fix-highlight-column branch May 1, 2020 20:01
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.

Function name highlighting not correct
2 participants