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

Fixed declaration type completions when extra whitespace is present #1107

Merged
merged 7 commits into from
Dec 10, 2020

Conversation

majastrz
Copy link
Member

@majastrz majastrz commented Dec 10, 2020

This fixes #718. Also refactored some of the completion logic to use the newer style.

@@ -153,70 +153,54 @@ private static List<SyntaxBase> FindNodesMatchingOffset(ProgramSyntax syntax, in

private static BicepCompletionContextKind GetDeclarationTypeFlags(IList<SyntaxBase> matchingNodes, int offset)
{
if (matchingNodes.Count < 2)
// local function
bool CheckTypeIsExpected(SyntaxBase name, SyntaxBase type) => name.Span.Length > 0 && offset > name.Span.Position + name.Span.Length && offset <= type.Span.Position;
Copy link
Member Author

Choose a reason for hiding this comment

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

The fix was to adjust the condition in this function (the commit called "fix" covers it... mostly). All other changes in this file are just a refactor to change this logic to use the tail matcher.

@codecov-io
Copy link

codecov-io commented Dec 10, 2020

Codecov Report

Merging #1107 (7ae9b35) into main (c42a908) will decrease coverage by 0.00%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1107      +/-   ##
==========================================
- Coverage   94.27%   94.26%   -0.01%     
==========================================
  Files         328      328              
  Lines       15856    15853       -3     
  Branches       12       12              
==========================================
- Hits        14948    14944       -4     
- Misses        908      909       +1     
Flag Coverage Δ
dotnet 94.82% <85.71%> (-0.01%) ⬇️
typescript 25.78% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...p.LangServer/Completions/BicepCompletionContext.cs 95.71% <85.71%> (-0.53%) ⬇️

@majastrz majastrz merged commit 11d63bd into main Dec 10, 2020
@majastrz majastrz deleted the majastrz/cursors-in-spaces branch December 10, 2020 19:48
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.

Wrong declaration type completions if whitespace is present after the cursor
3 participants