Skip to content

Commit

Permalink
Add warning support
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-botbol committed Nov 6, 2024
1 parent 412d957 commit 7d56710
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion server/src/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ let () =
Logs.set_reporter (combine logfile err_std);
Logs.set_level (Some Logs.Info);
Logs.info (fun m -> m "log file created: '%s'" logfile_path);
Catala_utils.Global.enforce_options ~message_format:Lsp () |> ignore
Catala_utils.Global.enforce_options
(* FIXME: this still prints warnings on stderr due to [Message] hard-wiring
[ifprintf] formatters *)
~disable_warnings:false ~message_format:Lsp ()
|> ignore

let run () =
Log.debug (fun m ->
Expand Down
4 changes: 3 additions & 1 deletion server/src/state.ml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type t = file
let err_severity = function
| Catala_utils.Message.Lexing | Parsing | Typing | Generic ->
DiagnosticSeverity.Error
| Warning -> Warning

let pp_range fmt { Range.start; end_ } =
let open Format in
Expand Down Expand Up @@ -416,6 +417,7 @@ let process_document ?previous_file ?contents (uri : string) : t =
in
let prg = Desugared.From_surface.translate_program ctx prg in
let prg = Desugared.Disambiguate.program prg in
let () = Desugared.Linting.lint_program prg in
let exceptions_graphs =
Scopelang.From_desugared.build_exceptions_graph prg
in
Expand All @@ -435,7 +437,7 @@ let process_document ?previous_file ?contents (uri : string) : t =
in
let prg = Scopelang.Ast.type_program prg in
let jump_table = Jump.populate ctx prg in
[], Some prg, Some jump_table
!l, Some prg, Some jump_table
with e ->
(match e with
| Catala_utils.Message.CompilerError er ->
Expand Down

0 comments on commit 7d56710

Please sign in to comment.