Skip to content
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
2 changes: 1 addition & 1 deletion cmd/src/lsif_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Examples:

Upload an LSIF dump when the LSIF indexer does not not declare a tool name.

$ src lsif upload -indexerName=lsif-elixir
$ src lsif upload -indexer=lsif-elixir
`

var flags struct {
Expand Down
10 changes: 9 additions & 1 deletion internal/codeintel/indexer_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ type toolInfo struct {
Name string `json:"name"`
}

// MaxBufferSize is the maximum size of the metaData line in the dump. This should be large enough
// to be able to read the output of lsif-tsc for most cases, which will contain all glob-expanded
// file names in the indexing of JavaScript projects.
//
// Data point: lodash's metaData vertex constructed by the args `*.js test/*.js --AllowJs --checkJs`
// is 10639 characters long.
const MaxBufferSize = 128 * 1024

// ErrMetadataExceedsBuffer occurs when the first line of an LSIF index is too long to read.
var ErrMetadataExceedsBuffer = errors.New("metaData vertex exceeds buffer")

Expand All @@ -26,7 +34,7 @@ var ErrInvalidMetaDataVertex = errors.New("invalid metaData vertex")
// This function reads only the first line of the file, where the metadata vertex is
// assumed to be in all valid dumps.
func ReadIndexerName(r io.Reader) (string, error) {
line, isPrefix, err := bufio.NewReader(r).ReadLine()
line, isPrefix, err := bufio.NewReaderSize(r, MaxBufferSize).ReadLine()
if err != nil {
return "", err
}
Expand Down