Skip to content

Commit

Permalink
Allows analyzer paths to be absolute (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaid-Ajaj authored Feb 17, 2020
1 parent 31877c3 commit 8535e38
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/FsAutoComplete/FsAutoComplete.Lsp.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1810,18 +1810,23 @@ type FsharpLspServer(commands: Commands, lspClient: FSharpLspClient) =
if config.EnableAnalyzers then
Loggers.analyzers.info (Log.setMessage "Using analyzer roots of {roots}" >> Log.addContextDestructured "roots" config.AnalyzersPath)
config.AnalyzersPath
|> Array.iter (fun a ->
|> Array.iter (fun analyzerPath ->
match rootPath with
| None -> ()
| Some rp ->
let dir = System.IO.Path.Combine(rp, a)
| Some workspacePath ->
let dir =
if System.IO.Path.IsPathRooted analyzerPath
// if analyzer is using absolute path, use it as is
then analyzerPath
// otherwise, it is a relative path and should be combined with the workspace path
else System.IO.Path.Combine(workspacePath, analyzerPath)
Loggers.analyzers.info (Log.setMessage "Loading analyzers from {dir}" >> Log.addContextDestructured "dir" dir)
dir
|> commands.LoadAnalyzers
|> Async.map (fun n ->
match n with
| CoreResponse.InfoRes msg ->
Loggers.analyzers.info (Log.setMessage "From {name}: {loadMessage}" >> Log.addContextDestructured "name" a >> Log.addContextDestructured "loadMessage" msg)
Loggers.analyzers.info (Log.setMessage "From {name}: {loadMessage}" >> Log.addContextDestructured "name" analyzerPath >> Log.addContextDestructured "loadMessage" msg)
| _ -> ()
)
|> Async.Start
Expand Down

0 comments on commit 8535e38

Please sign in to comment.