Skip to content

Commit

Permalink
Use the LSP server to improve support for dump and listing files
Browse files Browse the repository at this point in the history
This brings every navigation and edition feature for these files
  • Loading branch information
nberth committed Aug 7, 2024
1 parent feb726d commit 45a0b70
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lsp/cobol_lsp/lsp_document.ml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ include TYPES

type t = document
let uri { textdoc; _ } = Lsp.Text_document.documentUri textdoc
let language_id { textdoc; _ } = Lsp.Text_document.languageId textdoc

let rewindable_parse ({ project; textdoc; _ } as doc) =
Cobol_parser.rewindable_parse_with_artifacts
Expand All @@ -80,7 +81,10 @@ let rewindable_parse ({ project; textdoc; _ } as doc) =
copybook_lookup_config =
Lsp_project.copybook_lookup_config_for ~uri:(uri doc) project;
config = project.config.cobol_config;
source_format = project.config.source_format
source_format = match language_id doc with
| "COBOL_GNU_LISTFILE"
| "COBOL_GNU_DUMPFILE" -> SF SFVariable
| _ -> project.config.source_format
} @@
String { contents = Lsp.Text_document.text textdoc;
filename = Lsp.Uri.to_path (uri doc) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ let client_options () =
~documentSelector:[|
`Filter (LSP.DocumentFilter.createLanguage ()
~language:"cobol");
`Filter (LSP.DocumentFilter.createLanguage ()
~language:"COBOL_GNU_LISTFILE");
`Filter (LSP.DocumentFilter.createLanguage ()
~language:"COBOL_GNU_DUMPFILE");
|]


Expand Down

0 comments on commit 45a0b70

Please sign in to comment.