Skip to content

Commit

Permalink
Merge pull request #231 from vekatze/lsp-ignore-untracked-files
Browse files Browse the repository at this point in the history
lsp: ignore untracked source files during completion
  • Loading branch information
vekatze authored Nov 2, 2024
2 parents 1df852f + a6ebb42 commit b1b6c2d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Scene/LSP/Complete.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Context.AppM
import Context.Cache qualified as Cache
import Context.External (getClangDigest)
import Context.Path qualified as Path
import Context.Throw qualified as Throw
import Control.Monad
import Control.Monad.Trans
import Data.Bifunctor (second)
Expand Down Expand Up @@ -44,7 +45,11 @@ complete uri pos = do
currentSource <- lift (Source.reflect pathString) >>= liftMaybe
_ <- lift getClangDigest -- cache
let loc = positionToLoc pos
lift $ fmap concat $ forConcurrently itemGetterList $ \itemGetter -> itemGetter currentSource loc
lift (Throw.runMaybe $ collectCompletionItems currentSource loc) >>= liftMaybe

collectCompletionItems :: Source -> Loc -> App [CompletionItem]
collectCompletionItems currentSource loc = do
fmap concat $ forConcurrently itemGetterList $ \itemGetter -> itemGetter currentSource loc

itemGetterList :: [Source -> Loc -> App [CompletionItem]]
itemGetterList =
Expand Down

0 comments on commit b1b6c2d

Please sign in to comment.