Skip to content

Commit

Permalink
fix: use correct range for autocompletion
Browse files Browse the repository at this point in the history
  • Loading branch information
aboeglin committed Jun 17, 2024
1 parent 07a0417 commit 2618113
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions compiler/main/Run/LanguageServer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ handlers state autocompletionState = mconcat
let fileContent = T.unpack . virtualFileText <$> file
case fileContent of
Just content -> do
let foundLine = take (col + 1) $ lines content !! line
let foundLine = take col $ lines content !! line

suggestions <- getAutocompletionSuggestions autocompletionState (Loc 0 (line + 1) (col + 1)) (uriToPath uri) content
-- https://github.com/haskell/lsp/blob/76b86d54040cfa6c8306433a29404fa6402a5f69/lsp-types/src/Language/LSP/Types/Completion.hs
Expand Down Expand Up @@ -1178,7 +1178,7 @@ completionSuggestionsTask :: Loc -> FilePath -> String -> Rock.Task Query.Query
completionSuggestionsTask loc@(Loc _ line col) modulePath moduleContent = do
(typedAst, env) <- Rock.fetch $ Query.SolvedASTWithEnv modulePath

let foundLine = take col $ lines moduleContent !! (line - 1)
let foundLine = take (col - 1) $ lines moduleContent !! (line - 1)
let autocompletionKind = computeAutocompletionKind (reverse foundLine)

let topLevelExp = findTopLevelExp loc (Slv.aexps typedAst)
Expand Down
2 changes: 1 addition & 1 deletion madlib.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 2.0
-- see: https://github.com/sol/hpack

name: madlib
version: 0.24.0
version: 0.24.1
description: Please see the README on GitHub at <https://github.com/madlib-lang/madlib#readme>
homepage: https://github.com/madlib-lang/madlib#readme
bug-reports: https://github.com/madlib-lang/madlib/issues
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: madlib
version: 0.24.0
version: 0.24.1
github: "madlib-lang/madlib"
license: BSD3
author: "Arnaud Boeglin, Brekk Bockrath"
Expand Down
2 changes: 1 addition & 1 deletion pkg/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@madlib-lang/madlib",
"version": "0.24.0",
"version": "0.24.1",
"main": "./src/run.js",
"bin": {
"madlib": "src/run.js"
Expand Down

0 comments on commit 2618113

Please sign in to comment.