Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't load all preludes if one of them is opened #166

Merged
merged 3 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/lsp/loop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ let finally st e =
let process preludes path opt_contents =
let dir = Filename.dirname path in
let file = Filename.basename path in
let preludes =
let rec aux l =
match l with
| [] -> []
| State.{ dir = d; source = `File f; _ } :: _
when String.equal f file && String.equal dir d -> []
(* When the opened file is one of the prelude files, ignore it and the
following prelude files. *)
| h :: t -> h :: aux t
in
aux preludes
in
let l_file : _ State.file = {
lang = None; mode = None; dir;
loc = Dolmen.Std.Loc.mk_file "";
Expand Down
2 changes: 1 addition & 1 deletion src/lsp/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let preprocess_uri uri =
else uri

let mk_prelude files =
List.map (
List.rev_map (
hra687261 marked this conversation as resolved.
Show resolved Hide resolved
fun f ->
let dir, file = Dolmen_loop.State.split_input (`File f) in
Dolmen_loop.State.mk_file dir file
Expand Down
Loading