Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Switch to resolving expensive completionItem details #344

Merged
merged 9 commits into from
Sep 8, 2017

Conversation

tomv564
Copy link
Contributor

@tomv564 tomv564 commented Sep 4, 2017

Requesting extra completion details was found to be very expensive in #331, this PR will require clients to request these details via a separate request.

To do:

  • Clean up commented code

@codecov
Copy link

codecov bot commented Sep 4, 2017

Codecov Report

Merging #344 into master will increase coverage by 0.13%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #344      +/-   ##
==========================================
+ Coverage   60.03%   60.16%   +0.13%     
==========================================
  Files          14       14              
  Lines        2137     2149      +12     
  Branches      350      351       +1     
==========================================
+ Hits         1283     1293      +10     
- Misses        705      706       +1     
- Partials      149      150       +1
Impacted Files Coverage Δ
src/typescript-service.ts 72.47% <88.88%> (+0.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bd29fc3...f5913ac. Read the comment docs.

Copy link
Contributor

@felixfbecker felixfbecker left a comment

Choose a reason for hiding this comment

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

Great job

insertText: 'qux',
detail: '(property) A.qux: number'
}
]);
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this assertion removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The snippets logic is only used when resolving completion items, and I thought it would be a lot of logic to resolve all the items from the initial response.
Now that I think of it, it's probably not that bad - I'll give it a try!

Copy link
Contributor

Choose a reason for hiding this comment

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

I would leave this test as is (just change the objects) and add a separate test for the resolving

insertTextFormat: InsertTextFormat.Snippet,
sortText: '0',
detail: '(method) A.bar(num: number): number'
});
Copy link
Contributor

Choose a reason for hiding this comment

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

this would better be a second test

uri,
offset,
entryName: entry.name
};
Copy link
Contributor

Choose a reason for hiding this comment

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

could you define an interface for this / add this to a custom CompletionItem interface in request-type?

item.insertTextFormat = InsertTextFormat.PlainText;
item.insertText = details.name;
}
delete item.data;
Copy link
Contributor

Choose a reason for hiding this comment

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

delete is slow, is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not needed. It would be nice to reduce payload and not have to include the field in the asserts on resolved completion items (I wonder if the tests should even care at all what is in the data field?). Could we set to undefined, null, or should I just leave it be?

@tomv564
Copy link
Contributor Author

tomv564 commented Sep 4, 2017

I didn't split the snippets test cases yet, and assigned undefined to the data field after resolving for now. Thanks for the comments!

@tomv564
Copy link
Contributor Author

tomv564 commented Sep 6, 2017

@felixfbecker: your review comments are addressed, commented code is removed.

One snippet improvement was also included:
Previously all completions that were not property returned function(arguments..) style snippets, which is clearly not appropriate for e.g. Interface completions. The function-style snippets are now only returned for method and function completion item kinds.

@felixfbecker felixfbecker merged commit 289d69e into sourcegraph:master Sep 8, 2017
@tomv564 tomv564 deleted the resolve-completions branch September 9, 2017 09:35
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.

2 participants