Skip to content

Commit

Permalink
Fix code action scaffold (#1188)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd authored Oct 27, 2023
1 parent 2403ad1 commit be075d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions build/ScaffoldCodeFix.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ open Fantomas.Core.SyntaxOak

let repositoryRoot = __SOURCE_DIRECTORY__ </> ".."

let AdaptiveFSharpLspServerPath =
let AdaptiveServerStatePath =
repositoryRoot
</> "src"
</> "FsAutoComplete"
</> "LspServers"
</> "AdaptiveFSharpLspServer.fs"
</> "AdaptiveServerState.fs"


let TestsPath =
Expand Down Expand Up @@ -248,15 +248,15 @@ let findTypeWithNameOfFail (typeName: string) (mn: ModuleOrNamespaceNode) : ITyp
| _ -> None)

let findArrayInAdaptiveFSharpLspServer () : ExprArrayOrListNode =
let oak = getOakFor AdaptiveFSharpLspServerPath
let oak = getOakFor AdaptiveServerStatePath

// namespace FsAutoComplete.Lsp
let ns =
oak.ModulesOrNamespaces
|> List.exactlyOneOrFail "Expected a single namespace in Oak."

// type AdaptiveFSharpLspServer
let t = findTypeWithNameOfFail "AdaptiveFSharpLspServer" ns
// type AdaptiveState
let t = findTypeWithNameOfFail "AdaptiveState" ns

// let codefixes =
let codefixesValue =
Expand Down Expand Up @@ -299,12 +299,12 @@ let wireCodeFixInAdaptiveFSharpLspServer codeFixName =
try
let array = findArrayInAdaptiveFSharpLspServer ()

appendItemToArrayOrList $"%s{codeFixName}.fix tryGetParseResultsForFile" AdaptiveFSharpLspServerPath array
appendItemToArrayOrList $"%s{codeFixName}.fix tryGetParseResultsForFile" AdaptiveServerStatePath array
with ex ->
Trace.traceException ex

Trace.traceError
$"Unable to find array of codefixes in %s{AdaptiveFSharpLspServerPath}.\nDid the code structure change?"
$"Unable to find array of codefixes in %s{AdaptiveServerStatePath}.\nDid the code structure change?"


let mkCodeFixTests codeFixName =
Expand Down
2 changes: 1 addition & 1 deletion docs/Creating a new code fix.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The above command accomplishes the following tasks:

Furthermore, this command updates the following files to properly register the new code fix:

- `src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs`
- `src/FsAutoComplete/LspServers/AdaptiveState.fs`
- `test/FsAutoComplete.Tests.Lsp/CodeFixTests/Tests.fs`

The unit test file contains a [single focused test](https://github.com/haf/expecto#focusing-tests), allowing you to promptly verify the functionality. To run this initial test, you have two options:
Expand Down

0 comments on commit be075d8

Please sign in to comment.