Browse Source

Fixed marking of similar tokens for instance in: exit(EXIT_SUCCESS);

merge-requests/365/head
eidheim 10 years ago
parent
commit
cbfd0bd956
  1. 4
      src/source.cc

4
src/source.cc

@ -1398,6 +1398,8 @@ void Source::ClangViewParse::show_type_tooltips(const Gdk::Rectangle &rectangle)
type_tooltips.clear(); type_tooltips.clear();
for(auto &token: *tokens) { for(auto &token: *tokens) {
if(token.get_kind()==clang::Token_Identifier && token.has_type()) { if(token.get_kind()==clang::Token_Identifier && token.has_type()) {
if(static_cast<unsigned>(token.get_cursor().get_kind())==103) //These cursors are buggy
continue;
auto start=get_buffer()->get_iter_at_line_index(token.offsets.first.line-1, token.offsets.first.index-1); auto start=get_buffer()->get_iter_at_line_index(token.offsets.first.line-1, token.offsets.first.index-1);
auto end=get_buffer()->get_iter_at_line_index(token.offsets.second.line-1, token.offsets.second.index-1); auto end=get_buffer()->get_iter_at_line_index(token.offsets.second.line-1, token.offsets.second.index-1);
auto create_tooltip_buffer=[this, &token]() { auto create_tooltip_buffer=[this, &token]() {
@ -1867,6 +1869,8 @@ Source::ClangViewAutocomplete(file_path, project_path, language) {
for(auto &token: *clang_tokens) { for(auto &token: *clang_tokens) {
if(token.get_kind()==clang::Token_Identifier && token.has_type()) { if(token.get_kind()==clang::Token_Identifier && token.has_type()) {
if(line==token.offsets.first.line-1 && index>=token.offsets.first.index-1 && index <=token.offsets.second.index-1) { if(line==token.offsets.first.line-1 && index>=token.offsets.first.index-1 && index <=token.offsets.second.index-1) {
if(static_cast<unsigned>(token.get_cursor().get_kind())==103) //These cursors are buggy
continue;
auto referenced=token.get_cursor().get_referenced(); auto referenced=token.get_cursor().get_referenced();
if(referenced) if(referenced)
return {referenced.get_usr(), static_cast<int>(referenced.get_kind())}; return {referenced.get_usr(), static_cast<int>(referenced.get_kind())};

Loading…
Cancel
Save