-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement basic nested language support and add first end to end test
this is blocked by dotnet/fsharp#15925 because FCS APIs don't provide us with attribute lists
- Loading branch information
Showing
10 changed files
with
419 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
module FsAutoComplete.Tests.NestedLanguageTests | ||
|
||
open Expecto | ||
open Utils.ServerTests | ||
open Helpers | ||
open Utils.Server | ||
open System | ||
open Ionide.LanguageServerProtocol.Types | ||
|
||
type Document with | ||
|
||
member x.NestedLanguages = | ||
x.Server.Events | ||
|> Document.typedEvents<FsAutoComplete.Lsp.TextDocumentNestedLanguages> ("fsharp/textDocument/nestedLanguages") | ||
|> Observable.filter (fun n -> n.TextDocument = x.VersionedTextDocumentIdentifier) | ||
|
||
let hasLanguages name source expectedLanguages server = | ||
testAsync name { | ||
let! (doc, _) = server |> Server.createUntitledDocument source | ||
let! nestedLanguages = doc.NestedLanguages |> Async.AwaitObservable | ||
|
||
let mappedExpectedLanguages: FsAutoComplete.Lsp.NestedLanguage array = | ||
expectedLanguages | ||
|> Array.map (fun (l, rs) -> | ||
{ Language = l | ||
Ranges = | ||
rs | ||
|> Array.map (fun ((sl, sc), (el, ec)) -> | ||
{ Start = { Line = sl; Character = sc } | ||
End = { Line = el; Character = ec } }) }) | ||
|
||
Expect.equal nestedLanguages.NestedLanguages mappedExpectedLanguages "languages" | ||
} | ||
|
||
let tests state = | ||
testList | ||
"nested languages" | ||
[ serverTestList "class member" state defaultConfigDto None (fun server -> | ||
[ hasLanguages | ||
"with single string parameter" | ||
""" | ||
let b = System.UriBuilder("https://google.com") | ||
""" | ||
[| ("uri", [| (1, 38), (1, 58) |]) |] | ||
server ]) ] |
Oops, something went wrong.