aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/index/build.odin27
-rw-r--r--src/index/indexer.odin3
-rw-r--r--src/server/analysis.odin5
-rw-r--r--src/server/documents.odin2
-rw-r--r--src/server/requests.odin1
5 files changed, 24 insertions, 14 deletions
diff --git a/src/index/build.odin b/src/index/build.odin
index 890de2b..aba37f1 100644
--- a/src/index/build.odin
+++ b/src/index/build.odin
@@ -51,18 +51,27 @@ build_static_index :: proc(allocator := context.allocator, config: ^common.Confi
data, ok := os.read_entire_file(fullpath, context.temp_allocator);
if !ok {
+ log.errorf("failed to read entire file for indexing %v", fullpath);
continue;
}
p := parser.Parser {
- err = no_error_handler,
- warn = no_warning_handler,
+ err = log_error_handler,
+ warn = log_warning_handler,
};
//have to cheat the parser since it really wants to parse an entire package with the new changes...
+
+ dir := filepath.base(filepath.dir(fullpath, context.temp_allocator));
+
pkg := new(ast.Package);
pkg.kind = .Normal;
pkg.fullpath = fullpath;
+ pkg.name = dir;
+
+ if dir == "runtime" {
+ pkg.kind = .Runtime;
+ }
file := ast.File {
fullpath = fullpath,
@@ -72,8 +81,14 @@ build_static_index :: proc(allocator := context.allocator, config: ^common.Confi
ok = parser.parse_file(&p, &file);
+ if !ok {
+ log.info(pkg);
+ log.errorf("error in parse file for indexing %v", fullpath);
+ }
+
uri := common.create_uri(fullpath, context.temp_allocator);
+ //ERROR hover on uri does not show string
collect_symbols(&symbol_collection, file, uri.uri);
free_all(context.temp_allocator);
@@ -91,12 +106,12 @@ free_static_index :: proc() {
}
-no_error_handler :: proc(pos: tokenizer.Pos, msg: string, args: ..any) {
-
+log_error_handler :: proc(pos: tokenizer.Pos, msg: string, args: ..any) {
+ log.errorf("%v %v %v", pos, msg, args);
}
-no_warning_handler :: proc(pos: tokenizer.Pos, msg: string, args: ..any) {
-
+log_warning_handler :: proc(pos: tokenizer.Pos, msg: string, args: ..any) {
+ log.warnf("%v %v %v", pos, msg, args);
}
diff --git a/src/index/indexer.odin b/src/index/indexer.odin
index e04febd..70f28c1 100644
--- a/src/index/indexer.odin
+++ b/src/index/indexer.odin
@@ -32,9 +32,6 @@ import "core:sort"
us to rebuild parts of the index without too much of a performance hit.
This index is first searched and if nothing is found look in the static index.
-
- TODO(Daniel, Look into data structure for fuzzy searching)
-
*/
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index d3d0c22..2096fd4 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -785,7 +785,6 @@ resolve_type_identifier :: proc(ast_context: ^AstContext, node: ast.Ident) -> (i
//if there are more of these variables that hard builtin, move them to the indexer
else if node.name == "context" {
- log.info("found context");
return index.lookup("Context", ast_context.current_package);
}
//keywords
@@ -1149,6 +1148,8 @@ make_symbol_struct_from_ast :: proc(ast_context: ^AstContext, v: ast.Struct_Type
get_globals :: proc(file: ast.File, ast_context: ^AstContext) {
+ ast_context.variables["context"] = true;
+
for decl in file.decls {
if value_decl, ok := decl.derived.(ast.Value_Decl); ok {
@@ -1159,6 +1160,7 @@ get_globals :: proc(file: ast.File, ast_context: ^AstContext) {
if value_decl.type != nil {
ast_context.globals[str] = value_decl.type;
+ ast_context.variables[str] = value_decl.is_mutable;
}
else {
@@ -1933,7 +1935,6 @@ get_hover_information :: proc(document: ^Document, position: common.Position) ->
return {}, true;
}
-//ERROR can't got to common.Position
get_completion_list :: proc(document: ^Document, position: common.Position) -> (CompletionList, bool) {
list: CompletionList;
diff --git a/src/server/documents.odin b/src/server/documents.odin
index bf8a04f..383b40b 100644
--- a/src/server/documents.odin
+++ b/src/server/documents.odin
@@ -451,8 +451,6 @@ parse_document :: proc(document: ^Document, config: ^common.Config) -> ([] Parse
document.imports[index].base = path.base(document.imports[index].name, false);
}
- //ERROR not showing signature
- //log.info()
}
}
diff --git a/src/server/requests.odin b/src/server/requests.odin
index fe80ac9..0da4b0a 100644
--- a/src/server/requests.odin
+++ b/src/server/requests.odin
@@ -450,7 +450,6 @@ request_initialize :: proc(task: ^common.Task) {
common.pool_init(&pool, thread_count);
common.pool_start(&pool);
- //ERROR can't go to defintion
for format in initialize_params.capabilities.textDocument.hover.contentFormat {
if format == "markdown" {
config.hover_support_md = true;