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

Add test and fix signature off-by-one #782

Merged
merged 2 commits into from
May 14, 2021

Conversation

mhoogendoorn
Copy link
Contributor

The fsharp/signature extension also seems to be a victim of the 'Great Offset Shift of 2021' (see #767, #774, #771).

The tests are basically the first tooltip tests from CoreTests.fs. Not sure what is preferred, to have them there because they share logic (e.g. server), or if they should be in ExtensionTests because they test a custom endpoint. Currently in the latter, should it have a separate TestCases file instead of reusing the TestCases/Tooltips.fs file?

(a quick search shows a few more places where Lexer.findLongIdents(pos.Column - 1, lineStr) is used, likely they are affected as well).

@baronfel
Copy link
Contributor

This is a wonderful surprise :) Thank you for taking the time to investigate and write some tests! Yes, the Great Offset Shift is having reprecussions to this day, not the least of which was moving all text reading over to a less-error-prone model! (see ISourceText, etc).

You're likely correct about these follow-on places that use pos.Column - 1, I've had them as kind of a mental bucket list to add tests to and pin behavior down, but hadn't gotten around to them yet!

Regarding placement/naming of the tests, the name ExtensionsTests is meant to evoke the fact that Fake/FSharpLint/Fantomas are all external integrations, etc. I think the ideal case would be a new file for this endpoint specifically, we try to limit the blast radius by having 'isolated' test files as much as possible.

Copy link
Contributor

@baronfel baronfel left a comment

Choose a reason for hiding this comment

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

Great work overall! Just a couple requests here.

test/FsAutoComplete.Tests.Lsp/ExtensionsTests.fs Outdated Show resolved Hide resolved
test/FsAutoComplete.Tests.Lsp/ExtensionsTests.fs Outdated Show resolved Hide resolved
@baronfel
Copy link
Contributor

Regarding the test results here, the only one you really need to worry about is the macos one. There are some core issues we have to address on the Windows tests (a combination of case-sensitive path comparisons as well as some serious flakiness on the windows runners in GitHub Actions), as well as the ubuntu tests (unknown/undiagnosed hangs).

Use a separate testcase file for this endpoint.  Use `FilePathToUri`
instead of manually creating the uri.  Test all positions of the
identifier in a single `testCaseAsync`.
@baronfel
Copy link
Contributor

Thanks, this is a great change 👍. There are a couple other fixes I want to try and land this weekend, then I'll do a release including this change.

@baronfel baronfel merged commit 98afac0 into ionide:master May 14, 2021
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.

2 participants