diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2020-12-24 01:57:18 +0100 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2020-12-24 01:57:18 +0100 |
| commit | cee93b98af7d2d8fec2479e1f42bbfb269e5a8f3 (patch) | |
| tree | 7325ba29fd4c0ed4a324a179595cc2b2a8593c11 /src/index | |
| parent | b705b47a80ce8d2037b961ad429d1f4c6bc295e9 (diff) | |
fixed error not indexing runtime package because of the new odin change
Diffstat (limited to 'src/index')
| -rw-r--r-- | src/index/build.odin | 27 | ||||
| -rw-r--r-- | src/index/indexer.odin | 3 |
2 files changed, 21 insertions, 9 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) - */ |