Skip to content

Commit 5f6dfb8

Browse files
committed
feat: enhance symbol lookup to support non-plain format symbol queries
1 parent 1be29a3 commit 5f6dfb8

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

internal/service/indexer.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ type ProgressInfo struct {
148148
}
149149

150150
const (
151-
defaultConcurrency = 1
152-
defaultBatchSize = 50
153-
defaultMapBatchSize = 5
154-
defaultMaxFiles = 10000
155-
defaultMaxProjects = 3
156-
defaultCacheCapacity = 10_0000 // 假定单个文件平均10个元素,1万个文件
157-
defaultTopN = 10
151+
defaultConcurrency = 1
152+
defaultBatchSize = 50
153+
defaultMapBatchSize = 5
154+
defaultMaxFiles = 10000
155+
defaultMaxProjects = 3
156+
defaultCacheCapacity = 10_0000 // 假定单个文件平均10个元素,1万个文件
157+
defaultTopN = 10
158158
)
159159

160160
// NewCodeIndexer 创建新的代码索引器
@@ -1156,6 +1156,11 @@ func (i *indexer) QueryDefinitions(ctx context.Context, opts *types.QueryDefinit
11561156
}
11571157
symbolNames := make([]string, 0)
11581158
for s := range strings.SplitSeq(opts.SymbolNames, ",") {
1159+
idx := strings.LastIndex(s, ".")
1160+
if idx != -1 {
1161+
// types.QueryCallGraphOptions → QueryCallGraphOptions
1162+
s = s[idx+1:] // 有点,取最后一个点后面
1163+
}
11591164
if t := strings.TrimSpace(s); t != "" {
11601165
symbolNames = append(symbolNames, t)
11611166
}
@@ -1387,6 +1392,7 @@ func safeFilePath(workspace, relativeFilePath string) (string, error) {
13871392
defer root.Close()
13881393
return filepath.Join(workspace, relativeFilePath), nil
13891394
}
1395+
13901396
// 获取符号定义代码块里面的调用图
13911397
func (i *indexer) QueryCallGraph(ctx context.Context, opts *types.QueryCallGraphOptions) ([]*types.RelationNode, error) {
13921398
startTime := time.Now()

0 commit comments

Comments
 (0)