aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2022-06-19 15:15:48 +0200
committerDaniel Gavin <danielgavin5@hotmail.com>2022-06-19 15:15:48 +0200
commit772d60c65246d252bda676aa09c371ad9985e2b7 (patch)
tree03466d85173c25e0ed43e95f3cad5a9e35b71575 /src
parent09fdb88a25c3cc350bc1256b2f48c5d5a297807e (diff)
move document struct back to server
Diffstat (limited to 'src')
-rw-r--r--src/common/ast.odin6
-rw-r--r--src/common/types.odin20
-rw-r--r--src/server/analysis.odin20
-rw-r--r--src/server/build.odin4
-rw-r--r--src/server/caches.odin2
-rw-r--r--src/server/collector.odin2
-rw-r--r--src/server/completion.odin2
-rw-r--r--src/server/definition.odin2
-rw-r--r--src/server/document_links.odin2
-rw-r--r--src/server/document_symbols.odin2
-rw-r--r--src/server/documents.odin43
-rw-r--r--src/server/format.odin2
-rw-r--r--src/server/hover.odin6
-rw-r--r--src/server/indexer.odin29
-rw-r--r--src/server/inlay_hints.odin2
-rw-r--r--src/server/lens.odin2
-rw-r--r--src/server/references.odin2
-rw-r--r--src/server/rename.odin2
-rw-r--r--src/server/requests.odin27
-rw-r--r--src/server/semantic_tokens.odin2
-rw-r--r--src/server/signature.odin2
21 files changed, 84 insertions, 97 deletions
diff --git a/src/common/ast.odin b/src/common/ast.odin
index 2b581c1..cb01c85 100644
--- a/src/common/ast.odin
+++ b/src/common/ast.odin
@@ -252,8 +252,10 @@ get_doc :: proc(comment: ^ast.Comment_Group, allocator: mem.Allocator) -> string
}
if tmp != "" {
- replaced, allocated := strings.replace_all(tmp, "//", "", context.temp_allocator)
- return strings.clone(replaced, allocator)
+ no_lines, _ := strings.replace_all(tmp, "//", "", context.temp_allocator)
+ no_begin_comments, _ := strings.replace_all(no_lines, "/*", "", context.temp_allocator)
+ no_end_comments, _ := strings.replace_all(no_begin_comments, "*/", "", context.temp_allocator)
+ return strings.clone(no_end_comments, allocator)
}
}
diff --git a/src/common/types.odin b/src/common/types.odin
index 231a42b..8481f50 100644
--- a/src/common/types.odin
+++ b/src/common/types.odin
@@ -23,25 +23,5 @@ WorkspaceFolder :: struct {
uri: string,
}
-Package :: struct {
- name: string, //the entire absolute path to the directory
- base: string,
-}
-
-Document :: struct {
- uri: Uri,
- fullpath: string,
- text: []u8,
- used_text: int, //allow for the text to be reallocated with more data than needed
- client_owned: bool,
- diagnosed_errors: bool,
- ast: ast.File,
- imports: []Package,
- package_name: string,
- allocator: ^Scratch_Allocator, //because parser does not support freeing I use arena allocators for each document
- operating_on: int, //atomic
- version: Maybe(int),
-}
-
parser_warning_handler :: proc(pos: tokenizer.Pos, msg: string, args: ..any) {
} \ No newline at end of file
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 5c40e7e..8043148 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -70,7 +70,7 @@ AstContext :: struct {
usings: [dynamic]string,
file: ast.File,
allocator: mem.Allocator,
- imports: []common.Package, //imports for the current document
+ imports: []Package, //imports for the current document
current_package: string,
document_package: string,
use_globals: bool,
@@ -84,7 +84,7 @@ AstContext :: struct {
recursion_counter: int, //Sometimes the ast is so malformed that it causes infinite recursion.
}
-make_ast_context :: proc(file: ast.File, imports: []common.Package, package_name: string, uri: string, allocator := context.temp_allocator) -> AstContext {
+make_ast_context :: proc(file: ast.File, imports: []Package, package_name: string, uri: string, allocator := context.temp_allocator) -> AstContext {
ast_context := AstContext {
locals = make(map[int]map[string][dynamic]DocumentLocal, 0, allocator),
globals = make(map[string]common.GlobalExpr, 0, allocator),
@@ -1875,7 +1875,11 @@ make_symbol_struct_from_ast :: proc(ast_context: ^AstContext, v: ast.Struct_Type
continue
}
append(&names, identifier.name)
- append(&types, clone_type(field.type, ast_context.allocator, nil))
+ if v.poly_params != nil {
+ append(&types, clone_type(field.type, ast_context.allocator, nil))
+ } else {
+ append(&types, field.type)
+ }
if .Using in field.flags {
usings[identifier.name] = true
}
@@ -2455,7 +2459,7 @@ clear_locals :: proc(ast_context: ^AstContext) {
clear(&ast_context.usings)
}
-resolve_entire_file :: proc(document: ^common.Document, skip_locals := false, allocator := context.allocator) -> map[uintptr]SymbolAndNode {
+resolve_entire_file :: proc(document: ^Document, skip_locals := false, allocator := context.allocator) -> map[uintptr]SymbolAndNode {
ast_context := make_ast_context(document.ast, document.imports, document.package_name, document.uri.uri, allocator)
get_globals(document.ast, &ast_context)
@@ -2787,7 +2791,7 @@ field_exists_in_comp_lit :: proc(comp_lit: ^ast.Comp_Lit, name: string) -> bool
/*
Parser gives ranges of expression, but not actually where the commas are placed.
*/
-get_call_commas :: proc(position_context: ^DocumentPositionContext, document: ^common.Document) {
+get_call_commas :: proc(position_context: ^DocumentPositionContext, document: ^Document) {
if position_context.call == nil {
return
}
@@ -2834,7 +2838,7 @@ type_to_string :: proc(ast_context: ^AstContext, expr: ^ast.Expr) -> string {
/*
Figure out what exactly is at the given position and whether it is in a function, struct, etc.
*/
-get_document_position_context :: proc(document: ^common.Document, position: common.Position, hint: DocumentPositionContextHint) -> (DocumentPositionContext, bool) {
+get_document_position_context :: proc(document: ^Document, position: common.Position, hint: DocumentPositionContextHint) -> (DocumentPositionContext, bool) {
position_context: DocumentPositionContext
position_context.hint = hint
@@ -2911,7 +2915,7 @@ get_document_position_context :: proc(document: ^common.Document, position: comm
}
//terrible fallback code
-fallback_position_context_completion :: proc(document: ^common.Document, position: common.Position, position_context: ^DocumentPositionContext) {
+fallback_position_context_completion :: proc(document: ^Document, position: common.Position, position_context: ^DocumentPositionContext) {
paren_count: int
bracket_count: int
end: int
@@ -3119,7 +3123,7 @@ fallback_position_context_completion :: proc(document: ^common.Document, positio
}
}
-fallback_position_context_signature :: proc(document: ^common.Document, position: common.Position, position_context: ^DocumentPositionContext) {
+fallback_position_context_signature :: proc(document: ^Document, position: common.Position, position_context: ^DocumentPositionContext) {
end: int
start: int
i := position_context.position - 1
diff --git a/src/server/build.odin b/src/server/build.odin
index 41690c6..c172db8 100644
--- a/src/server/build.odin
+++ b/src/server/build.odin
@@ -141,7 +141,7 @@ build_static_index :: proc(allocator := context.allocator, config: ^common.Confi
free_all(context.allocator)
}
- indexer.static_index = make_memory_index(symbol_collection)
+ indexer.index = make_memory_index(symbol_collection)
if config.enable_references {
for fullpath in files {
@@ -203,7 +203,7 @@ build_static_index :: proc(allocator := context.allocator, config: ^common.Confi
delete(files)
delete(temp_arena.data)
- indexer.static_index = make_memory_index(symbol_collection)
+ indexer.index = make_memory_index(symbol_collection)
}
free_static_index :: proc() {
diff --git a/src/server/caches.odin b/src/server/caches.odin
index f446679..d260de2 100644
--- a/src/server/caches.odin
+++ b/src/server/caches.odin
@@ -9,7 +9,7 @@ FileResolveCache :: struct {
file_resolve_cache: FileResolveCache
-resolve_entire_file_cached :: proc(document: ^common.Document) -> map[uintptr]SymbolAndNode{
+resolve_entire_file_cached :: proc(document: ^Document) -> map[uintptr]SymbolAndNode{
if document.uri.uri not_in file_resolve_cache.files {
file_resolve_cache.files[document.uri.uri] = resolve_entire_file(
document,
diff --git a/src/server/collector.odin b/src/server/collector.odin
index fc40b11..ee93404 100644
--- a/src/server/collector.odin
+++ b/src/server/collector.odin
@@ -435,7 +435,7 @@ Reference :: struct {
}
collect_references :: proc(collection: ^SymbolCollection, file: ast.File, uri: string) -> common.Error {
- document := common.Document {
+ document := Document {
ast = file,
}
diff --git a/src/server/completion.odin b/src/server/completion.odin
index ed5ee84..218bbc3 100644
--- a/src/server/completion.odin
+++ b/src/server/completion.odin
@@ -32,7 +32,7 @@ Completion_Type :: enum {
Package,
}
-get_completion_list :: proc(document: ^common.Document, position: common.Position, completion_context: CompletionContext) -> (CompletionList, bool) {
+get_completion_list :: proc(document: ^Document, position: common.Position, completion_context: CompletionContext) -> (CompletionList, bool) {
list: CompletionList
position_context, ok := get_document_position_context(document, position, .Completion)
diff --git a/src/server/definition.odin b/src/server/definition.odin
index 3bcdcb3..a01c6a9 100644
--- a/src/server/definition.odin
+++ b/src/server/definition.odin
@@ -16,7 +16,7 @@ import "core:os"
import "shared:common"
-get_definition_location :: proc(document: ^common.Document, position: common.Position) -> ([]common.Location, bool) {
+get_definition_location :: proc(document: ^Document, position: common.Position) -> ([]common.Location, bool) {
locations := make([dynamic]common.Location, context.temp_allocator)
location: common.Location
diff --git a/src/server/document_links.odin b/src/server/document_links.odin
index 08330ab..0049509 100644
--- a/src/server/document_links.odin
+++ b/src/server/document_links.odin
@@ -17,7 +17,7 @@ import "core:os"
import "shared:common"
-get_document_links :: proc(document: ^common.Document) -> ([]DocumentLink, bool) {
+get_document_links :: proc(document: ^Document) -> ([]DocumentLink, bool) {
links := make([dynamic]DocumentLink, 0, context.temp_allocator)
for imp in document.ast.imports {
diff --git a/src/server/document_symbols.odin b/src/server/document_symbols.odin
index b442bfe..9fa170b 100644
--- a/src/server/document_symbols.odin
+++ b/src/server/document_symbols.odin
@@ -17,7 +17,7 @@ import "core:os"
import "shared:common"
-get_document_symbols :: proc(document: ^common.Document) -> []DocumentSymbol {
+get_document_symbols :: proc(document: ^Document) -> []DocumentSymbol {
ast_context := make_ast_context(document.ast, document.imports, document.package_name, document.uri.uri)
get_globals(document.ast, &ast_context)
diff --git a/src/server/documents.odin b/src/server/documents.odin
index 8142524..3e3cb3c 100644
--- a/src/server/documents.odin
+++ b/src/server/documents.odin
@@ -23,8 +23,29 @@ ParserError :: struct {
offset: int,
}
+Package :: struct {
+ name: string, //the entire absolute path to the directory
+ base: string,
+}
+
+Document :: struct {
+ uri: common.Uri,
+ fullpath: string,
+ text: []u8,
+ used_text: int, //allow for the text to be reallocated with more data than needed
+ client_owned: bool,
+ diagnosed_errors: bool,
+ ast: ast.File,
+ imports: []Package,
+ package_name: string,
+ allocator: ^common.Scratch_Allocator, //because parser does not support freeing I use arena allocators for each document
+ operating_on: int, //atomic
+ version: Maybe(int),
+}
+
+
DocumentStorage :: struct {
- documents: map[string]common.Document,
+ documents: map[string]Document,
free_allocators: [dynamic]^common.Scratch_Allocator,
}
@@ -59,7 +80,7 @@ document_free_allocator :: proc(allocator: ^common.Scratch_Allocator) {
append(&document_storage.free_allocators, allocator)
}
-document_get :: proc(uri_string: string) -> ^common.Document {
+document_get :: proc(uri_string: string) -> ^Document {
uri, parsed_ok := common.parse_uri(uri_string, context.temp_allocator)
if !parsed_ok {
@@ -78,7 +99,7 @@ document_get :: proc(uri_string: string) -> ^common.Document {
return document
}
-document_release :: proc(document: ^common.Document) {
+document_release :: proc(document: ^Document) {
if document != nil {
intrinsics.atomic_sub(&document.operating_on, 1)
}
@@ -114,7 +135,7 @@ document_open :: proc(uri_string: string, text: string, config: ^common.Config,
return err
}
} else {
- document := common.Document {
+ document := Document {
uri = uri,
text = transmute([]u8)text,
client_owned = true,
@@ -136,7 +157,7 @@ document_open :: proc(uri_string: string, text: string, config: ^common.Config,
return .None
}
-document_setup :: proc(document: ^common.Document) {
+document_setup :: proc(document: ^Document) {
//Right now not all clients return the case correct windows path, and that causes issues with indexing, so we ensure that it's case correct.
when ODIN_OS == .Windows {
package_name := path.dir(document.uri.path, context.temp_allocator)
@@ -273,7 +294,7 @@ document_close :: proc(uri_string: string) -> common.Error {
return .None
}
-document_refresh :: proc(document: ^common.Document, config: ^common.Config, writer: ^Writer) -> common.Error {
+document_refresh :: proc(document: ^Document, config: ^common.Config, writer: ^Writer) -> common.Error {
errors, ok := parse_document(document, config)
if !ok {
@@ -347,7 +368,7 @@ parser_error_handler :: proc(pos: tokenizer.Pos, msg: string, args: ..any) {
append(&current_errors, error)
}
-parse_document :: proc(document: ^common.Document, config: ^common.Config) -> ([]ParserError, bool) {
+parse_document :: proc(document: ^Document, config: ^common.Config) -> ([]ParserError, bool) {
p := parser.Parser {
err = parser_error_handler,
warn = common.parser_warning_handler,
@@ -379,8 +400,8 @@ parse_document :: proc(document: ^common.Document, config: ^common.Config) -> ([
return current_errors[:], true
}
-parse_imports :: proc(document: ^common.Document, config: ^common.Config) {
- imports := make([dynamic]common.Package)
+parse_imports :: proc(document: ^Document, config: ^common.Config) {
+ imports := make([dynamic]Package)
for imp, index in document.ast.imports {
if i := strings.index(imp.fullpath, "\""); i == -1 {
@@ -402,7 +423,7 @@ parse_imports :: proc(document: ^common.Document, config: ^common.Config) {
continue
}
- import_: common.Package
+ import_: Package
import_.name = strings.clone(path.join(elems = {dir, p}, allocator = context.temp_allocator))
if imp.name.text != "" {
@@ -418,7 +439,7 @@ parse_imports :: proc(document: ^common.Document, config: ^common.Config) {
continue
}
- import_: common.Package
+ import_: Package
import_.name = path.join(elems = {document.package_name, imp.fullpath[1:len(imp.fullpath) - 1]}, allocator = context.temp_allocator)
import_.name = path.clean(import_.name)
diff --git a/src/server/format.odin b/src/server/format.odin
index 4c51943..e461044 100644
--- a/src/server/format.odin
+++ b/src/server/format.odin
@@ -17,7 +17,7 @@ DocumentFormattingParams :: struct {
options: FormattingOptions,
}
-get_complete_format :: proc(document: ^common.Document, config: ^common.Config) -> ([]TextEdit, bool) {
+get_complete_format :: proc(document: ^Document, config: ^common.Config) -> ([]TextEdit, bool) {
style := printer.default_style
style.max_characters = config.formatter.characters
style.tabs = config.formatter.tabs
diff --git a/src/server/hover.odin b/src/server/hover.odin
index 56e8bb0..98eaa50 100644
--- a/src/server/hover.odin
+++ b/src/server/hover.odin
@@ -35,7 +35,7 @@ write_hover_content :: proc(ast_context: ^AstContext, symbol: Symbol) -> MarkupC
if cat != "" {
content.kind = "markdown"
- content.value = fmt.tprintf("```odin\n %v\n```\n%v", cat, symbol.doc)
+ content.value = fmt.tprintf("```odin\n%v\n```\n%v", cat, symbol.doc)
} else {
content.kind = "plaintext"
}
@@ -44,11 +44,11 @@ write_hover_content :: proc(ast_context: ^AstContext, symbol: Symbol) -> MarkupC
}
builtin_identifier_hover: map[string]string = {
- "context" = fmt.aprintf("```odin\n %v\n```\n%v", "runtime.context: Context", "This context variable is local to each scope and is implicitly passed by pointer to any procedure call in that scope (if the procedure has the Odin calling convention)."),
+ "context" = fmt.aprintf("```odin\n%v\n```\n%v", "runtime.context: Context", "This context variable is local to each scope and is implicitly passed by pointer to any procedure call in that scope (if the procedure has the Odin calling convention)."),
}
-get_hover_information :: proc(document: ^common.Document, position: common.Position) -> (Hover, bool, bool) {
+get_hover_information :: proc(document: ^Document, position: common.Position) -> (Hover, bool, bool) {
hover := Hover {
contents = {
kind = "plaintext",
diff --git a/src/server/indexer.odin b/src/server/indexer.odin
index ce0404b..d4a1498 100644
--- a/src/server/indexer.odin
+++ b/src/server/indexer.odin
@@ -36,9 +36,8 @@ import "core:sort"
Indexer :: struct {
- builtin_packages: [dynamic]string,
- static_index: MemoryIndex,
- dynamic_index: MemoryIndex,
+ builtin_packages: [dynamic]string,
+ index: MemoryIndex,
dynamic_uri_owned: map[string]bool,
}
@@ -50,12 +49,7 @@ FuzzyResult :: struct {
}
lookup :: proc(name: string, pkg: string, loc := #caller_location) -> (Symbol, bool) {
- if symbol, ok := memory_index_lookup(&indexer.dynamic_index, name, pkg); ok {
- log.infof("lookup dynamic name: %v pkg: %v, symbol %v location %v", name, pkg, symbol, loc)
- return symbol, true
- }
-
- if symbol, ok := memory_index_lookup(&indexer.static_index, name, pkg); ok && symbol.uri not_in indexer.dynamic_uri_owned {
+ if symbol, ok := memory_index_lookup(&indexer.index, name, pkg); ok && symbol.uri not_in indexer.dynamic_uri_owned {
log.infof("lookup name: %v pkg: %v, symbol %v location %v", name, pkg, symbol, loc)
return symbol, true
}
@@ -65,27 +59,18 @@ lookup :: proc(name: string, pkg: string, loc := #caller_location) -> (Symbol, b
}
lookup_reference :: proc(name: string, pkg: string) -> (Reference, bool) {
- return memory_reference_lookup(&indexer.static_index, name, pkg)
+ return memory_reference_lookup(&indexer.index, name, pkg)
}
fuzzy_search :: proc(name: string, pkgs: []string) -> ([]FuzzyResult, bool) {
- dynamic_results, dynamic_ok := memory_index_fuzzy_search(&indexer.dynamic_index, name, pkgs)
- static_results, static_ok := memory_index_fuzzy_search(&indexer.static_index, name, pkgs)
+ results, ok := memory_index_fuzzy_search(&indexer.index, name, pkgs)
result := make([dynamic]FuzzyResult, context.temp_allocator)
- if !dynamic_ok || !static_ok {
+ if !ok {
return {}, false
}
- for r in dynamic_results {
- append(&result, r)
- }
-
- for r in static_results {
- if r.symbol.uri in indexer.dynamic_uri_owned {
- continue
- }
-
+ for r in results {
append(&result, r)
}
diff --git a/src/server/inlay_hints.odin b/src/server/inlay_hints.odin
index eb93075..9833309 100644
--- a/src/server/inlay_hints.odin
+++ b/src/server/inlay_hints.odin
@@ -5,7 +5,7 @@ import "core:fmt"
import "shared:common"
-get_inlay_hints :: proc(document: ^common.Document, symbols: map[uintptr]SymbolAndNode) -> ([]InlayHint, bool) {
+get_inlay_hints :: proc(document: ^Document, symbols: map[uintptr]SymbolAndNode) -> ([]InlayHint, bool) {
hints := make([dynamic]InlayHint, context.temp_allocator)
ast_context := make_ast_context(document.ast, document.imports, document.package_name, document.uri.uri)
diff --git a/src/server/lens.odin b/src/server/lens.odin
index abde537..ab25b47 100644
--- a/src/server/lens.odin
+++ b/src/server/lens.odin
@@ -20,7 +20,7 @@ CodeLens :: struct {
data: string,
}
-get_code_lenses :: proc(document: ^common.Document, position: common.Position) -> ([]CodeLens, bool) {
+get_code_lenses :: proc(document: ^Document, position: common.Position) -> ([]CodeLens, bool) {
ast_context := make_ast_context(document.ast, document.imports, document.package_name, document.uri.uri)
get_globals(document.ast, &ast_context)
diff --git a/src/server/references.odin b/src/server/references.odin
index 5566234..d7c3fea 100644
--- a/src/server/references.odin
+++ b/src/server/references.odin
@@ -9,7 +9,7 @@ import "core:encoding/json"
import path "core:path/slashpath"
import "core:log"
-get_references :: proc(document: ^common.Document, position: common.Position) -> ([]common.Location, bool) {
+get_references :: proc(document: ^Document, position: common.Position) -> ([]common.Location, bool) {
locations := make([dynamic]common.Location, context.temp_allocator)
ast_context := make_ast_context(document.ast, document.imports, document.package_name, document.uri.uri)
diff --git a/src/server/rename.odin b/src/server/rename.odin
index 16becbc..20d7478 100644
--- a/src/server/rename.odin
+++ b/src/server/rename.odin
@@ -5,7 +5,7 @@ import "shared:common"
import "core:log"
import "core:odin/ast"
-get_rename :: proc(document: ^common.Document, new_text: string, position: common.Position) -> (WorkspaceEdit, bool) {
+get_rename :: proc(document: ^Document, new_text: string, position: common.Position) -> (WorkspaceEdit, bool) {
workspace: WorkspaceEdit
document_changes := make([dynamic]TextDocumentEdit, context.temp_allocator)
diff --git a/src/server/requests.odin b/src/server/requests.odin
index db06cad..d4338bb 100644
--- a/src/server/requests.odin
+++ b/src/server/requests.odin
@@ -49,7 +49,7 @@ RequestType :: enum {
RequestInfo :: struct {
root: json.Value,
params: json.Value,
- document: ^common.Document,
+ document: ^Document,
id: RequestId,
config: ^common.Config,
writer: ^Writer,
@@ -360,7 +360,7 @@ call :: proc(value: json.Value, id: RequestId, writer: ^Writer, config: ^common.
}
}
- log.infof("time duration %v for %v", time.duration_milliseconds(diff), method)
+ log.errorf("time duration %v for %v", time.duration_milliseconds(diff), method)
}
request_initialize :: proc (params: json.Value, id: RequestId, config: ^common.Config, writer: ^Writer) -> common.Error {
@@ -384,7 +384,6 @@ request_initialize :: proc (params: json.Value, id: RequestId, config: ^common.C
read_ols_config :: proc(file: string, config: ^common.Config, uri: common.Uri) {
if data, ok := os.read_entire_file(file, context.temp_allocator); ok {
-
if value, err := json.parse(data = data, allocator = context.temp_allocator, parse_integers = true); err == .None {
ols_config := OlsConfig {
formatter = {
@@ -394,7 +393,6 @@ request_initialize :: proc (params: json.Value, id: RequestId, config: ^common.C
}
if unmarshal(value, ols_config, context.temp_allocator) == nil {
-
config.thread_count = ols_config.thread_pool_count
config.enable_document_symbols = ols_config.enable_document_symbols
config.enable_hover = ols_config.enable_hover
@@ -402,6 +400,7 @@ request_initialize :: proc (params: json.Value, id: RequestId, config: ^common.C
config.enable_semantic_tokens = ols_config.enable_semantic_tokens
config.enable_procedure_context = ols_config.enable_procedure_context
config.enable_snippets = ols_config.enable_snippets
+ config.enable_references = false
config.verbose = ols_config.verbose
config.file_log = ols_config.file_log
config.formatter = ols_config.formatter
@@ -410,7 +409,6 @@ request_initialize :: proc (params: json.Value, id: RequestId, config: ^common.C
config.enable_inlay_hints = ols_config.enable_inlay_hints
for p in ols_config.collections {
-
forward_path, _ := filepath.to_slash(p.path, context.temp_allocator)
if filepath.is_abs(p.path) {
@@ -481,14 +479,14 @@ request_initialize :: proc (params: json.Value, id: RequestId, config: ^common.C
config.enable_snippets &= initialize_params.capabilities.textDocument.completion.completionItem.snippetSupport
config.signature_offset_support = initialize_params.capabilities.textDocument.signatureHelp.signatureInformation.parameterInformation.labelOffsetSupport
- completionTriggerCharacters := []string {".", ">", "#", "\"", "/", ":"}
- signatureTriggerCharacters := []string {"(", ","}
+ completionTriggerCharacters := []string {".", ">", "#", "\"", "/", ":"}
+ signatureTriggerCharacters := []string {"(", ","}
signatureRetriggerCharacters := []string {","}
- token_type := type_info_of(SemanticTokenTypes).variant.(runtime.Type_Info_Named).base.variant.(runtime.Type_Info_Enum)
+ token_type := type_info_of(SemanticTokenTypes).variant.(runtime.Type_Info_Named).base.variant.(runtime.Type_Info_Enum)
token_modifier := type_info_of(SemanticTokenModifiers).variant.(runtime.Type_Info_Named).base.variant.(runtime.Type_Info_Enum)
- token_types := make([]string, len(token_type.names), context.temp_allocator)
+ token_types := make([]string, len(token_type.names), context.temp_allocator)
token_modifiers := make([]string, len(token_modifier.names), context.temp_allocator)
for name, i in token_type.names {
@@ -549,9 +547,6 @@ request_initialize :: proc (params: json.Value, id: RequestId, config: ^common.C
Temp index here, but should be some background thread that starts the indexing
*/
- indexer.dynamic_index = make_memory_index(make_symbol_collection(context.allocator, config))
- indexer.dynamic_uri_owned = make(map[string]bool, 200, context.allocator)
-
build_static_index(context.allocator, config)
/*
@@ -820,9 +815,9 @@ notification_did_save :: proc (params: json.Value, id: RequestId, config: ^commo
dir := filepath.base(filepath.dir(fullpath, context.temp_allocator))
pkg := new(ast.Package)
- pkg.kind = .Normal
+ pkg.kind = .Normal
pkg.fullpath = fullpath
- pkg.name = dir
+ pkg.name = dir
if dir == "runtime" {
pkg.kind = .Runtime
@@ -839,7 +834,7 @@ notification_did_save :: proc (params: json.Value, id: RequestId, config: ^commo
if !ok {
log.errorf("error in parse file for indexing %v", fullpath)
}
-
+ /*
for k, v in &indexer.dynamic_index.collection.packages {
for k2, v2 in &v {
if v2.uri == uri.uri {
@@ -854,7 +849,7 @@ notification_did_save :: proc (params: json.Value, id: RequestId, config: ^commo
}
indexer.dynamic_uri_owned[uri.uri] = true
-
+ */
check(uri, writer, config)
return .None
diff --git a/src/server/semantic_tokens.odin b/src/server/semantic_tokens.odin
index 79d5dd8..7f0f322 100644
--- a/src/server/semantic_tokens.odin
+++ b/src/server/semantic_tokens.odin
@@ -93,7 +93,7 @@ get_tokens :: proc(builder: SemanticTokenBuilder) -> SemanticTokens {
}
}
-get_semantic_tokens :: proc(document: ^common.Document, range: common.Range, symbols: map[uintptr]SymbolAndNode) -> SemanticTokens {
+get_semantic_tokens :: proc(document: ^Document, range: common.Range, symbols: map[uintptr]SymbolAndNode) -> SemanticTokens {
builder := make_token_builder()
if document.ast.pkg_decl != nil {
diff --git a/src/server/signature.odin b/src/server/signature.odin
index 5f47381..b9c400c 100644
--- a/src/server/signature.odin
+++ b/src/server/signature.odin
@@ -110,7 +110,7 @@ seperate_proc_field_arguments :: proc(procedure: ^Symbol) {
}
}
-get_signature_information :: proc(document: ^common.Document, position: common.Position) -> (SignatureHelp, bool) {
+get_signature_information :: proc(document: ^Document, position: common.Position) -> (SignatureHelp, bool) {
signature_help: SignatureHelp
ast_context := make_ast_context(document.ast, document.imports, document.package_name, document.uri.uri)