Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scoring: score methods and funcs the same #666

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion build/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1015,13 +1015,24 @@ type aStruct struct {}
`),
query: &query.Substring{Content: true, Pattern: "aStruct"},
wantLanguage: "Go",
// 7000 (full base match) + 900 (Go interface) + 500 (word) + 10 (file order)
// 7000 (full base match) + 900 (Go struct) + 500 (word) + 10 (file order)
wantScore: 8410,
},
{
fileName: "src/net/http/client.go",
content: []byte(`
package http
func aFunc() bool {}
`),
query: &query.Substring{Content: true, Pattern: "aFunc"},
wantLanguage: "Go",
// 7000 (full base match) + 800 (Go function) + 500 (word) + 10 (file order)
wantScore: 8310,
},
{
fileName: "src/net/http/client.go",
content: []byte(`
package http
func Get() {
panic("")
}
Expand Down
8 changes: 2 additions & 6 deletions contentprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,10 +670,8 @@ func scoreKind(language string, kind string) float64 {
factor = 9
case "interface":
factor = 8
case "function", "func":
case "function", "func", "method":
factor = 7
case "method":
factor = 6
case "member", "field":
factor = 5.5
case "constant", "const":
Expand Down Expand Up @@ -731,9 +729,7 @@ func scoreKind(language string, kind string) float64 {
// 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
case "method", "function": // methodSpec
factor = 8
case "variable": // var member
factor = 7
Expand Down
Loading