Skip to content
Snippets Groups Projects
Commit 7dc1abcb authored by Allan Blanchard's avatar Allan Blanchard
Browse files

[lint] load OCP-Indent config once

parent f92363be
No related branches found
No related tags found
No related merge requests found
...@@ -172,16 +172,26 @@ let check_eoleof ~update content = ...@@ -172,16 +172,26 @@ let check_eoleof ~update content =
been removed and the printer changed so that it prints into a buffer and not been removed and the printer changed so that it prints into a buffer and not
a file. a file.
*) *)
let global_config = ref None
let config () =
match !global_config with
| None ->
let config, syntaxes, dlink = IndentConfig.local_default () in
IndentLoader.load ~debug:false dlink ;
Approx_lexer.disable_extensions ();
List.iter
(fun stx ->
try Approx_lexer.enable_extension stx
with IndentExtend.Syntax_not_found name ->
Format.eprintf "Warning: unknown syntax extension %S@." name)
syntaxes ;
global_config := Some config ;
config
| Some config -> config
let ocp_indent channel = let ocp_indent channel =
let config, syntaxes, dlink = IndentConfig.local_default () in let config = config () in
IndentLoader.load ~debug:false dlink ;
Approx_lexer.disable_extensions ();
List.iter
(fun stx ->
try Approx_lexer.enable_extension stx
with IndentExtend.Syntax_not_found name ->
Format.eprintf "Warning: unknown syntax extension %S@." name)
syntaxes ;
let buffer = Buffer.create 0 in let buffer = Buffer.create 0 in
let out = IndentPrinter.{ let out = IndentPrinter.{
debug = false; config = config; indent_empty = false; adaptive = true; debug = false; config = config; indent_empty = false; adaptive = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment