Skip to content

Commit

Permalink
Merge branch 'master' of github.com:yatli/coc-fsharp
Browse files Browse the repository at this point in the history
  • Loading branch information
yatli committed May 20, 2019
2 parents 4051331 + 56de770 commit 745caa9
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
2 changes: 2 additions & 0 deletions client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export function activate(context: ExtensionContext) {
args: [],
transport: TransportKind.stdio
}

workspace.addRootPatterns('fsharp', ['*.fsproj', '*.fsx', 'projects.assets.json', '.vim', '.git', '.hg'])

// Options to control the language client
let clientOptions: LanguageClientOptions = {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Yatao Li",
"license": "MIT",
"icon": "Icon512.png",
"version": "0.1.32",
"version": "0.1.33",
"publisher": "yatli",
"repository": {
"type": "git",
Expand Down
13 changes: 9 additions & 4 deletions src/FSharpLanguageServer/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -844,13 +844,18 @@ type Server(client: ILanguageClient) =
}
member this.ExecuteCommand(p: ExecuteCommandParams): Async<unit> = TODO()
member this.DidChangeWorkspaceFolders(p: DidChangeWorkspaceFoldersParams): Async<unit> =
let __doworkspace (xs: WorkspaceFolder list) fn =
async {
for root in xs do
let file = FileInfo(root.uri.LocalPath)
do! fn file.Directory
}
async {
for root in p.event.added do
let file = FileInfo(root.uri.LocalPath)
do! projects.AddWorkspaceRoot(file.Directory)
// TODO removed
do! __doworkspace p.event.added projects.AddWorkspaceRoot
do! __doworkspace p.event.removed projects.RemoveWorkspaceRoot
}


[<EntryPoint>]
let main(argv: array<string>): int =
let read = new BinaryReader(Console.OpenStandardInput())
Expand Down
11 changes: 11 additions & 0 deletions src/FSharpLanguageServer/ProjectManager.fs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,17 @@ type ProjectManager(checker: FSharpChecker) as this =
else if f.Name.EndsWith(".sln") then
knownSolutions.[f.FullName] <- slnProjectReferences(f)
}
member this.RemoveWorkspaceRoot(root: DirectoryInfo): Async<unit> =
async {
for f in root.EnumerateFiles("*.*", SearchOption.AllDirectories) do
knownProjects.Remove(f.FullName) |> ignore
knownSolutions.Remove(f.FullName) |> ignore
}
member this.ClearWorkspaceRoot(): Async<unit> =
async {
knownProjects.Clear()
knownSolutions.Clear()
}
member this.DeleteProjectFile(fsprojOrFsx: FileInfo) =
knownProjects.Remove(fsprojOrFsx.FullName) |> ignore
cache.Invalidate(fsprojOrFsx) |> ignore
Expand Down

0 comments on commit 745caa9

Please sign in to comment.