Skip to content

Commit

Permalink
change package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
WeituoDAI committed May 9, 2023
1 parent 7ff001f commit bba445a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 34 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
"Snippets",
"Other"
],
"activationEvents": [],
"activationEvents": [
"onLanguage:cobol"
],
"contributes": {
"languages": [
{
Expand Down
34 changes: 1 addition & 33 deletions src/superbol-vscode-extension/superbol_vscode_extension.ml
Original file line number Diff line number Diff line change
Expand Up @@ -112,43 +112,11 @@ in src/superbol-vscode-extension/package.toml, add Cobol_indentation
let promise = Some [ Vscode.TextEdit.replace ~range ~newText:output_text ] in
`Value promise *)


let testformat
~document
~options:_
~token:_
=

let editor = Vscode.Window.activeTextEditor () in
let selection = Option.get editor |> Vscode.TextEditor.selection in
let anchor = Vscode.Selection.anchor selection in
let start_line = Vscode.Position.line anchor in
let active = Vscode.Selection.active selection in

let end_line = Vscode.Position.line active in
let start_line, end_line =
if start_line > end_line then end_line, start_line
else
start_line, end_line
in
let start_pos = Vscode.Position.make ~line:start_line ~character:0 in
let endCharacter =
String.length @@ Vscode.TextLine.text @@ Vscode.TextDocument.lineAt document ~line:end_line
in
let end_pos = Vscode.Position.make ~line:end_line ~character:endCharacter in
let range = Vscode.Range.makePositions ~start:start_pos ~end_:end_pos in

let input_text = Vscode.TextDocument.getText document ~range () in

let output_text = input_text ^ "~~~" in
let promise = Some [ Vscode.TextEdit.replace ~range ~newText:output_text ] in
`Value promise

let activate (extension: Vscode.ExtensionContext.t) =

let providerFull =
Vscode.DocumentFormattingEditProvider.create
~provideDocumentFormattingEdits: (testformat)
~provideDocumentFormattingEdits: (indentRange)
in

let disposable = Vscode.Languages.registerDocumentFormattingEditProvider
Expand Down

0 comments on commit bba445a

Please sign in to comment.