Skip to content

Commit

Permalink
Ignore requests that would cause circular dependencies (ionide#1173)
Browse files Browse the repository at this point in the history
* Ignore requests that would cause circular dependencies

* format
  • Loading branch information
dawedawe authored Oct 7, 2023
1 parent ca352cb commit bb8d0d7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4377,10 +4377,11 @@ type AdaptiveFSharpLspServer
>> Log.addContextDestructured "parms" p
)

do!
Commands.DotnetAddProject p.Target p.Reference
|> AsyncResult.ofCoreResponse
|> AsyncResult.ignore<unit option, JsonRpc.Error> // mapping unit option to unit
if p.Target <> p.Reference then
do!
Commands.DotnetAddProject p.Target p.Reference
|> AsyncResult.ofCoreResponse
|> AsyncResult.ignore<unit option, JsonRpc.Error> // mapping unit option to unit

return None
with e ->
Expand Down
8 changes: 6 additions & 2 deletions src/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2418,11 +2418,15 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory
>> Log.addContextDestructured "parms" p
)

let! res = Commands.DotnetAddProject p.Target p.Reference
let! res =
if p.Target <> p.Reference then
Commands.DotnetAddProject p.Target p.Reference
else
async.Return(CoreResponse.Res())

let res =
match res with
| CoreResponse.InfoRes msg -> success None
| CoreResponse.InfoRes _msg -> success None
| CoreResponse.ErrorRes msg -> LspResult.internalError msg
| CoreResponse.Res(_) -> success None

Expand Down

0 comments on commit bb8d0d7

Please sign in to comment.