Open Kelvin-Ng opened 6 years ago
I have fixed it by this patch:
diff --git a/src/messages/text_document_definition.cc b/src/messages/text_document_definition.cc
index ad688ea..7cd9bf1 100644
--- a/src/messages/text_document_definition.cc
+++ b/src/messages/text_document_definition.cc
@@ -82,7 +82,6 @@ struct Handler_TextDocumentDefinition
spell.range.Contains(target_line, target_column)) {
on_def = spell;
uses.clear();
- return false;
}
// We use spelling start and extent end because this causes vscode
// to highlight the entire definition when previewing / hoving with
@@ -101,8 +100,6 @@ struct Handler_TextDocumentDefinition
uses.push_back(*on_def);
}
AddRange(&out.result, GetLsLocations(db, working_files, uses));
- if (!out.result.empty())
- break;
}
// No symbols - check for includes.
Here is a similar issue:
template <typename T>
class Foo {
public:
int x;
int y;
};
template <>
class Foo<int> {
public:
int x;
int z;
};
template <typename T>
void bar() {
Foo<T> foo;
foo.x = 5;
}
int main() {
bar<int>(); // -- (1)
bar<std::string>(); // -- (2)
}
If (1) is chosen, with my patch, it lists both the int x
definitions when looking for definition of foo.x
. However, if (2) is chosen, even with my patch, it lists only the int x
definition of the general version. Is it an expected behavior? (because template<> class Foo<int>
actually does not exist if it is never used?)
Consider the follow code:
while
compile_commands.json
is:When I ask for jumping to the definition of
hello()
inside the body ofhello2()
, it always jump totemplate <typename T> void hello(const T& x)
. However, it should list bothtemplate <typename T> void hello(const T& x)
andvoid hello(const int& x)
and allow me to choose one of them to jump to.