aboutsummaryrefslogtreecommitdiff
path: root/src/server/format.odin
blob: 2520474172a01e2eddf9b2a4908a6649b0799434 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package server

import "shared:common"


//import "core:odin/printer"

FormattingOptions :: struct {
	tabSize:                uint,
	insertSpaces:           bool, //tabs or spaces
	trimTrailingWhitespace: bool,
	insertFinalNewline:     bool,
	trimFinalNewlines:      bool,
}

DocumentFormattingParams :: struct {
	textDocument: TextDocumentIdentifier,
	options:      FormattingOptions,
}

TextEdit :: struct {
	range:   common.Range,
	newText: string,
}

get_complete_format :: proc (document: ^Document) -> ([]TextEdit, bool) {
	/*
	prnt := printer.make_printer(printer.default_style, context.temp_allocator);

	printer.print_file(&prnt, &document.ast);

	end_line := document.ast.decls[len(document.ast.decls) - 1].end.line;

	edit := TextEdit {
		newText = printer.to_string(prnt),
		range = {
			start = {
				character = 0,
				line = 0,
			},
			end = {
				character = 1,
				line = end_line + 1,
			},
		},
	};

	edits := make([dynamic]TextEdit, context.temp_allocator);

	append(&edits, edit);

	return edits[:], true;
	*/
	return {}, true;
}