aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2020-12-07 21:37:00 +0100
committerDanielGavin <danielgavin5@hotmail.com>2020-12-07 21:37:00 +0100
commit9585a8c0d8f85f78696219b74e8353bbdaf3db4f (patch)
treea6b7123663c1f301fe64e9212b3fffb6b1d48946 /src/server
parent73600df80212cfcd1a9b6973da1553685f763eb8 (diff)
added support for relative importing
Diffstat (limited to 'src/server')
-rw-r--r--src/server/analysis.odin34
-rw-r--r--src/server/documents.odin26
2 files changed, 35 insertions, 25 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 146f8cb..b786597 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -1889,6 +1889,12 @@ get_signature_information :: proc(document: ^Document, position: common.Position
call: index.Symbol;
call, ok = resolve_type_expression(&ast_context, position_context.call);
+ if symbol, ok := call.value.(index.SymbolProcedureValue); !ok {
+ return signature_help, true;
+ }
+
+
+
signature_information := make([] SignatureInformation, 1, context.temp_allocator);
signature_information[0].label = concatenate_symbols_information(&ast_context, call);
@@ -1996,36 +2002,16 @@ fallback_position_context_completion :: proc(document: ^Document, position: comm
//log.info("FALLBACK TIME");
- log.infof("position character %c", position_context.file.src[position_context.position]);
-
paren_count: int;
bracket_count: int;
end: int;
start: int;
empty_dot: bool;
- i := position_context.position;
-
- //trim whitespaces
- for i >= 0 {
-
- c := position_context.file.src[i];
-
- if c != ' ' && c != '\r' && c != '\n' {
- break;
- }
-
- i -= 1;
- }
-
- if position_context.file.src[i] == ')' ||
- position_context.file.src[i] == '}' ||
- position_context.file.src[i] == '{' {
- i -= 1;
- }
+ i := position_context.position-1;
end = i;
- for i >= 0 {
+ for i > 0 {
c := position_context.file.src[i];
@@ -2055,7 +2041,7 @@ fallback_position_context_completion :: proc(document: ^Document, position: comm
bracket_count -= 1;
}
- if c == ' ' || c == '{' || c == ',' || c == '}' {
+ if c == ' ' || c == '{' || c == ',' || c == '}' || c == '\n' || c == '\r' {
start = i+1;
break;
}
@@ -2111,7 +2097,7 @@ fallback_position_context_signature :: proc(document: ^Document, position: commo
first_paren: bool;
i := position_context.position;
- for i >= 0 {
+ for i > 0 {
c := position_context.file.src[i];
diff --git a/src/server/documents.odin b/src/server/documents.odin
index dedc74a..41700b0 100644
--- a/src/server/documents.odin
+++ b/src/server/documents.odin
@@ -387,6 +387,8 @@ parse_document :: proc(document: ^Document, config: ^common.Config) -> ([] Parse
for imp, index in document.ast.imports {
+ //ERROR no completion on imp!
+
//collection specified
if i := strings.index(imp.fullpath, ":"); i != -1 && i > 1 {
@@ -402,12 +404,34 @@ parse_document :: proc(document: ^Document, config: ^common.Config) -> ([] Parse
}
document.imports[index].name = strings.clone(path.join(elems = {dir, p}, allocator = context.temp_allocator));
- document.imports[index].base = path.base(document.imports[index].name, false);
+
+ if imp.name.text != "" {
+ document.imports[index].base = imp.name.text;
+ }
+
+ else {
+ document.imports[index].base = path.base(document.imports[index].name, false);
+ }
+
}
//relative
else {
+ document.imports[index].name = path.join(elems = {document.package_name, imp.fullpath[1:len(imp.fullpath)-1]}, allocator = context.temp_allocator);
+
+ document.imports[index].name = path.clean(document.imports[index].name);
+
+ if imp.name.text != "" {
+ document.imports[index].base = imp.name.text;
+ }
+
+ else {
+ document.imports[index].base = path.base(document.imports[index].name, false);
+ }
+
+ //ERROR not showing signature
+ //log.info()
}
}