Skip to content

Commit

Permalink
Remove unused State/Commands
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd committed Oct 10, 2023
1 parent b9fc370 commit a8d0a0f
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 1,429 deletions.
52 changes: 0 additions & 52 deletions src/FsAutoComplete.Core/CodeGeneration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,58 +27,6 @@ type ICodeGenerationService =

abstract ParseFileInProject: string<LocalPath> -> Async<option<FSharpParseFileResults>>

type CodeGenerationService(checker: FSharpCompilerServiceChecker, state: State) =
interface ICodeGenerationService with
override x.TokenizeLine(fileName, i) =
asyncOption {
let! text = state.TryGetFileSource fileName |> Option.ofResult

try
let! line = text.GetLine(Position.mkPos i 0)
return Lexer.tokenizeLine [||] line
with _ ->
return! None
}

override x.GetSymbolAtPosition(fileName, pos: Position) =
asyncOption {
return!
match state.TryGetFileCheckerOptionsWithLinesAndLineStr(fileName, pos) with
| ResultOrString.Error _ -> None
| ResultOrString.Ok(opts, lines, line) ->
try
Lexer.getSymbol pos.Line pos.Column line SymbolLookupKind.Fuzzy [||]
with _ ->
None
}

override x.GetSymbolAndUseAtPositionOfKind(fileName, pos: Position, kind) =
asyncOption {
let! symbol = (x :> ICodeGenerationService).GetSymbolAtPosition(fileName, pos)

if symbol.Kind = kind then
match state.TryGetFileCheckerOptionsWithLinesAndLineStr(fileName, pos) with
| ResultOrString.Error _ -> return! None
| ResultOrString.Ok(opts, text, line) ->
let! result = checker.TryGetRecentCheckResultsForFile(fileName, opts, text)
let symbolUse = result.TryGetSymbolUse pos line
return! Some(symbol, symbolUse)
else
return! None
}

override x.ParseFileInProject(fileName) =
async {
match state.TryGetFileCheckerOptionsWithLines fileName with
| ResultOrString.Error _ -> return None
| ResultOrString.Ok(opts, text) ->
try
return
checker.TryGetRecentCheckResultsForFile(fileName, opts, text)
|> Option.map (fun n -> n.GetParseResults)
with _ ->
return None
}

module CodeGenerationUtils =
open FSharp.Compiler.Syntax.PrettyNaming
Expand Down
3 changes: 0 additions & 3 deletions src/FsAutoComplete.Core/CodeGeneration.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ type ICodeGenerationService =

abstract ParseFileInProject: string<LocalPath> -> Async<option<FSharpParseFileResults>>

type CodeGenerationService =
new: checker: FSharpCompilerServiceChecker * state: State -> CodeGenerationService
interface ICodeGenerationService

module CodeGenerationUtils =
open FSharp.Compiler.Syntax.PrettyNaming
Expand Down
Loading

0 comments on commit a8d0a0f

Please sign in to comment.