Skip to content

Commit

Permalink
new frontend: check .filename.merlin for file specific .merlin
Browse files Browse the repository at this point in the history
  • Loading branch information
let-def committed Feb 28, 2017
1 parent ed89cc1 commit cf93c20
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/frontend/new/new_merlin.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,15 @@ let run = function
Mconfig.({config with merlin = {config.merlin with failures}}) in
let config = Mconfig.(match config.query.directory with
| "" -> config
| dir ->
| cwd ->
let merlin = config.merlin in
let merlin = {merlin with dotmerlin_to_load =
dir :: merlin.dotmerlin_to_load} in
let path = Misc.canonicalize_filename ~cwd config.query.filename in
let path =
let base = "." ^ Filename.basename path ^ ".merlin" in
Filename.concat (Filename.dirname path) base
in
let dotmerlin_to_load = path :: merlin.dotmerlin_to_load in
let merlin = {merlin with dotmerlin_to_load} in
{config with merlin}
)
in
Expand Down
6 changes: 5 additions & 1 deletion src/kernel/mconfig_dot.ml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ let rec directives_of_file fname =
file ::
if file.recurse then
let path = file.path in
let dir = Filename.dirname @@ Filename.dirname @@ path in
let dir =
let dir = Filename.dirname path in
if Filename.basename path <> ".merlin"
then dir else Filename.dirname dir
in
if dir <> path then
directives_of_file dir
else []
Expand Down

0 comments on commit cf93c20

Please sign in to comment.