use exact type signatures for locating types for completion items

This commit is contained in:
Dave Holoway
2020-06-24 19:55:18 +01:00
parent b70592a0f7
commit 089d174e08
3 changed files with 91 additions and 66 deletions

View File

@@ -347,7 +347,7 @@ function packageDeclaration(tokens) {
*/
function importDeclaration(tokens, typemap) {
tokens.mark();
tokens.current.loc = 'fqn:';
tokens.current.loc = 'fqdi:';
tokens.expectValue('import');
const static_token = tokens.getIfValue('static');
let asterisk_token = null, dot;
@@ -359,12 +359,12 @@ function importDeclaration(tokens, typemap) {
addproblem(tokens, ParseProblem.Error(tokens.current, `Package identifier expected`));
}
if (name) {
name.loc = `fqn:${pkg_name_parts.join('.')}`;
name.loc = `fqdi:${pkg_name_parts.join('.')}`;
pkg_token_parts.push(name);
pkg_name_parts.push(name.value);
}
if (dot = tokens.getIfValue('.')) {
dot.loc = `fqn:${pkg_name_parts.join('.')}`;
dot.loc = `fqdi:${pkg_name_parts.join('.')}`;
if (!(asterisk_token = tokens.getIfValue('*'))) {
continue;
}

View File

@@ -35,7 +35,7 @@ class MemberExpression extends Expression {
}
if (instance instanceof PackageNameType) {
this.dot.loc = `fqs:${instance.package_name}`;
this.dot.loc = `fqdi:${instance.package_name}`;
if (!this.member) {
return instance;
}
@@ -60,7 +60,7 @@ class MemberExpression extends Expression {
return AnyType.Instance;
}
this.dot.loc = `${loc}:${instance.fullyDottedTypeName}`
this.dot.loc = `${loc}:${instance.typeSignature}`
if (!this.member) {
ri.problems.push(ParseProblem.Error(this.dot, `Identifier expected`));
return instance;