Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 13cba57

Browse files
authored
skip highlighting large lockfiles on all instances, not just dotcom (#63366)
This is a slow and CPU-intensive task, and there is little value in syntax-highlighting lockfiles. Just disable this on all instances, not only dotcom. ## Test plan CI ## Changelog - Syntax highlighting is disabled on lockfiles (such as `package-lock.json`) because it is CPU-intensive on these large files and very rarely desirable.
1 parent 0576d9e commit 13cba57

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

cmd/frontend/graphqlbackend/git_tree_entry.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
resolverstubs "github.com/sourcegraph/sourcegraph/internal/codeintel/resolvers"
2626
"github.com/sourcegraph/sourcegraph/internal/conf"
2727
"github.com/sourcegraph/sourcegraph/internal/database"
28-
"github.com/sourcegraph/sourcegraph/internal/dotcom"
2928
"github.com/sourcegraph/sourcegraph/internal/gitserver"
3029
"github.com/sourcegraph/sourcegraph/internal/gitserver/gitdomain"
3130
"github.com/sourcegraph/sourcegraph/internal/gosyntect"
@@ -282,13 +281,11 @@ func (r *GitTreeEntryResolver) Highlight(ctx context.Context, args *HighlightArg
282281
}
283282

284283
// special handling in dotcom to prevent syntax highlighting large lock files
285-
if dotcom.SourcegraphDotComMode() {
286-
for _, f := range syntaxHighlightFileBlocklist {
287-
if strings.HasSuffix(r.Path(), f) {
288-
// this will force the content to be returned as plaintext
289-
// without hitting the syntax highlighter
290-
args.Format = string(gosyntect.FormatHTMLPlaintext)
291-
}
284+
for _, f := range syntaxHighlightFileBlocklist {
285+
if strings.HasSuffix(r.Path(), f) {
286+
// this will force the content to be returned as plaintext
287+
// without hitting the syntax highlighter
288+
args.Format = string(gosyntect.FormatHTMLPlaintext)
292289
}
293290
}
294291

0 commit comments

Comments
 (0)