Skip to content

Commit

Permalink
scoring: handle scip-ctags kinds (#655)
Browse files Browse the repository at this point in the history
There are likely more that we are missing. We only briefly looked at
golang, likely other languages are also affected. The regression is
scip-ctags returning different values for kind.

Will follow-up with a more comprehensive workaround until scip-ctags
issues are resolved.

Test Plan: manually tested queries like "test server" against the golang
repo until the test server struct was the top result.

Co-authored-by: Stefan Hengl <[email protected]>
  • Loading branch information
keegancsmith and stefanhengl authored Oct 17, 2023
1 parent 659eac9 commit f17ff0b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions contentprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ func scoreKind(language string, kind string) float64 {

// Generic ranking which will be overriden by language specific ranking
switch kind {
case "type": // scip-ctags regression workaround https://github.com/sourcegraph/sourcegraph/issues/57659
factor = 8
case "class":
factor = 10
case "struct":
Expand Down Expand Up @@ -721,6 +723,19 @@ func scoreKind(language string, kind string) float64 {
}
case "Go", "go":
switch kind {
// scip-ctags regression workaround https://github.com/sourcegraph/sourcegraph/issues/57659
// for each case a description of the fields in ctags in the comment
case "type": // interface struct talias
factor = 10
case "method": // methodSpec
factor = 8.5
case "function": // func
factor = 8
case "variable": // var member
factor = 7
case "constant": // const
factor = 6

case "interface": // interfaces
factor = 10
case "struct": // structs
Expand Down

0 comments on commit f17ff0b

Please sign in to comment.