This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On type formatting #126
On type formatting #126
Changes from 32 commits
4f3434b
c52b83d
d8d1a74
410b13f
1a4c2db
cdbc45a
32bae79
659075b
5ad26bc
17656b9
ca86bd3
a506a8c
c3ce7b9
b956846
e5989df
ab1798d
770aa4e
b19ad65
eab9e6a
65842a2
a9f82ba
a9d219b
9027d4b
5c00a04
6630e87
1fab534
cae62a5
54556e3
0892c5b
73c6ff9
3c6a024
e182904
37d1348
ee32c09
edaca3f
4df670f
2e604ae
4177069
d2a6423
96f3652
87d3392
94c18a0
f1cec62
874a620
699b130
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is getting huge. Can we create LanguageServer folder and then separate FormattingTests file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you like me to do that in this PR, or a subsequent one? It might be more straightforward to make a PR to move all of the tests at once, since a lot of the "CreateServer" logic is shared between the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the good rules about the test is that the person who sees the test for the first time (but familiar with the code base) should be able to understand what's going on.
Here, without digging into implementation, I can only understand that you have created and initialized a
Server
instance and added a ProjectEntry to it with the content above. The rest is unclear.There is no problem for a test to have some more lines of code, but it is important for a test to be as clear as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you be more specific as to how you'd prefer it look? I'm not sure how this is unclear (or at least more unclear than tests like the Hover tests above it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally would write most tests for the simplest object - line formatter itself and add just few that involve the LS itself as to verify the integration. This helps if someone wants to borrow the formatter but doesn't need the LS - tests then are easy to take with the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's already how I have it set up. LineFormatterTests contains all of the test cases for the formatter itself. This test is just checking that the server does something. If you mean that I should remove any actual stylistic choices from here and do a simple check of "does the server return an edit instead of throwing NotImplemented", then I can do that too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I modified this test using the suggested added extension method to be more explicit, if you'd like to look again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have
ServerExtension
type that accumulates helper methods that help with simulating server activity. You can addSendDocumentOnTypeFormatting(Uri, Position, char)
helper for it and call it directly from the test.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implemented this, if you'd like to take a look.