Skip to content

Commit 39514fa

Browse files
fix: Don't emit SymbolInformation for local defs. (#32)
1 parent dd9a876 commit 39514fa

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

scip_indexer/SCIPIndexer.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -423,12 +423,14 @@ class SCIPState {
423423

424424
private:
425425
absl::Status saveDefinitionImpl(const core::GlobalState &gs, core::FileRef file, const string &symbolString,
426-
core::Loc occLoc) {
426+
core::Loc occLoc, bool isLocal) {
427427
ENFORCE(!symbolString.empty());
428428
occLoc = trimColonColonPrefix(gs, occLoc);
429-
scip::SymbolInformation symbolInfo;
430-
symbolInfo.set_symbol(symbolString);
431-
this->symbolMap[file].push_back(symbolInfo);
429+
if (!isLocal) {
430+
scip::SymbolInformation symbolInfo;
431+
symbolInfo.set_symbol(symbolString);
432+
this->symbolMap[file].push_back(symbolInfo);
433+
}
432434

433435
scip::Occurrence occurrence;
434436
occurrence.set_symbol(symbolString);
@@ -496,7 +498,8 @@ class SCIPState {
496498
if (this->cacheOccurrence(gs, file, occ, scip::SymbolRole::Definition)) {
497499
return absl::OkStatus();
498500
}
499-
return this->saveDefinitionImpl(gs, file, occ.toString(gs, file), core::Loc(file, occ.offsets));
501+
return this->saveDefinitionImpl(gs, file, occ.toString(gs, file), core::Loc(file, occ.offsets),
502+
/*isLocal*/ true);
500503
}
501504

502505
// Save definition when you have a sorbet Symbol.
@@ -518,7 +521,7 @@ class SCIPState {
518521

519522
auto occLoc = loc.has_value() ? core::Loc(file, loc.value()) : symRef.symbolLoc(gs);
520523

521-
return this->saveDefinitionImpl(gs, file, symbolString, occLoc);
524+
return this->saveDefinitionImpl(gs, file, symbolString, occLoc, /*isLocal*/ false);
522525
}
523526

524527
absl::Status saveReference(const core::GlobalState &gs, core::FileRef file, OwnedLocal occ, int32_t symbol_roles) {

0 commit comments

Comments
 (0)