diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000000..2efea72312bd --- /dev/null +++ b/.gitmodules @@ -0,0 +1,8 @@ +[submodule "tree-sitter-go"] + path = docker-images/syntax-highlighter/crates/sg-syntax/languages/tree-sitter-go + url = https://github.com/tree-sitter/tree-sitter-go + shallow = true +[submodule "tree-sitter-sql"] + path = docker-images/syntax-highlighter/crates/sg-syntax/languages/tree-sitter-sql + url = https://github.com/m-novikov/tree-sitter-sql + shallow = true diff --git a/.golangci.yml b/.golangci.yml index 359ad322f074..c00f24654ca5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -63,6 +63,7 @@ run: - ui - vendor - node_modules + - docker-images/syntax-highlighter skip-files: # Auto-generated with depguard and forbidigo failures diff --git a/.prettierignore b/.prettierignore index 8f998b980c3d..560460d78b03 100644 --- a/.prettierignore +++ b/.prettierignore @@ -26,6 +26,7 @@ doc/ **/__fixtures__ GH2SG.bookmarklet.js docker-images/grafana/config/provisioning/dashboards/sourcegraph/ +docker-images/syntax-highlighter/crates/ storybook-static/ browser/code-intel-extensions/ .buildkite-cache/ diff --git a/.tool-versions b/.tool-versions index a58198c326a8..0f85a9c88f3f 100644 --- a/.tool-versions +++ b/.tool-versions @@ -11,3 +11,4 @@ trivy 0.20.0 kustomize 4.0.5 awscli 2.4.7 python system +rust 1.58.0 diff --git a/buf.gen.yaml b/buf.gen.yaml index 00d651c5dde4..007c081836d2 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -12,3 +12,6 @@ plugins: path: ./.bin/protoc-gen-doc out: ./doc/code_intelligence/references opt: doc/code_intelligence/references/lsif.sprig,lsif.md + - name: rust + path: ./.bin/bin/protoc-gen-rust + out: ./docker-images/syntax-highlighter/crates/sg-lsif/src/ diff --git a/client/branded/src/global-styles/highlight.scss b/client/branded/src/global-styles/highlight.scss index 873631b1b665..46d5f315bd0d 100644 --- a/client/branded/src/global-styles/highlight.scss +++ b/client/branded/src/global-styles/highlight.scss @@ -94,6 +94,13 @@ --hl-purple: #6c71c4; --hl-pink: #d33682; + // TODO: Followup for https://github.com/sourcegraph/sourcegraph/issues/30995 + // Define these in a way that are good. These are just the same values as before. + --hl-dark-green: #859900; + --hl-dark-blue-1: #268bd2; + --hl-dark-blue-2: #268bd2; + --hl-dark-blue-3: #268bd2; + // These grays are not ordered at all, // they're just in the order they were defined --hl-gray-0: #767676; @@ -471,6 +478,120 @@ color: var(--hl-orange); } } + + // The following are syntax highlighting constructs for highlight + // groups returned by lsif-typed compatible indexers. + // + // Each group should exactly match the name of the spec. + // .hl-typed-$SYNTAX_KIND + + .hl-typed-Comment { + color: var(--hl-dark-green); + } + .hl-typed-PunctuationDelimiter { + color: var(--hl-orange); + } + .hl-typed-PunctuationBracket { + color: var(--hl-orange); + } + .hl-typed-IdentifierKeyword { + color: var(--hl-dark-blue-3); + } + .hl-typed-IdentifierOperator { + color: var(--hl-dark-blue-1); + } + .hl-typed-Identifier { + color: var(--hl-blue); + } + .hl-typed-IdentifierBuiltin { + color: var(--hl-blue); + // filter: brightness(105%); + } + .hl-typed-IdentifierNull { + color: var(--hl-orange); + // filter: brightness(130%); + } + .hl-typed-BooleanLiteral { + color: var(--hl-orange); + } + .hl-typed-IdentifierConstant { + color: var(--hl-dark-blue-1); + } + .hl-typed-IdentifierMutableGlobal { + color: var(--hl-dark-blue-1); + } + .hl-typed-IdentifierParameter { + color: var(--hl-blue); + } + .hl-typed-IdentifierLocal { + color: var(--hl-blue); + } + .hl-typed-IdentifierShadowed { + color: var(--hl-blue); + } + .hl-typed-IdentifierModule { + color: var(--hl-blue); + } + .hl-typed-IdentifierFunction { + color: var(--hl-yellow); + } + .hl-typed-IdentifierFunctionDefinition { + color: var(--hl-yellow); + } + .hl-typed-IdentifierMacro { + color: var(--hl-yellow); + } + .hl-typed-IdentifierMacroDefinition { + color: var(--hl-yellow); + } + .hl-typed-IdentifierType { + color: var(--hl-blue); + } + .hl-typed-IdentifierBuiltinType { + color: var(--hl-blue); + } + .hl-typed-IdentifierAttribute { + color: var(--hl-purple); + } + + // TODO: Followup for https://github.com/sourcegraph/sourcegraph/issues/30995 + // .hl-typed-RegexEscape { + // } + // .hl-typed-RegexRepeated { + // } + // .hl-typed-RegexWildcard { + // } + // .hl-typed-RegexDelimiter { + // } + // .hl-typed-RegexJoin { + // } + + .hl-typed-StringLiteral { + color: var(--hl-red); + } + .hl-typed-StringLiteralEscape { + color: var(--hl-red); + } + .hl-typed-StringLiteralSpecial { + color: var(--hl-red); + } + .hl-typed-StringLiteralKey { + color: var(--hl-red); + } + .hl-typed-CharacterLiteral { + color: var(--hl-red); + } + .hl-typed-NumericLiteral { + color: var(--hl-green-1); + } + + // TODO: Followup for https://github.com/sourcegraph/sourcegraph/issues/30995 + // .hl-typed-Tag { + // } + // .hl-typed-TagAttribute { + // } + // .hl-typed-TagDelimiter { + // } } .theme-dark { @@ -774,4 +895,118 @@ } } } + + // The following are syntax highlighting constructs for highlight + // groups returned by lsif-typed compatible indexers. + // + // Each group should exactly match the name of the spec. + // .hl-typed-$SYNTAX_KIND + + .hl-typed-Comment { + color: var(--hl-dark-green); + } + .hl-typed-PunctuationDelimiter { + color: var(--hl-orange); + } + .hl-typed-PunctuationBracket { + color: var(--hl-orange); + } + .hl-typed-IdentifierKeyword { + color: var(--hl-dark-blue-3); + } + .hl-typed-IdentifierOperator { + color: var(--hl-dark-blue-1); + } + .hl-typed-Identifier { + color: var(--hl-blue); + } + .hl-typed-IdentifierBuiltin { + color: var(--hl-blue); + // filter: brightness(105%); + } + .hl-typed-IdentifierNull { + color: var(--hl-orange); + // filter: brightness(130%); + } + .hl-typed-BooleanLiteral { + color: var(--hl-orange); + } + .hl-typed-IdentifierConstant { + color: var(--hl-dark-blue-1); + } + .hl-typed-IdentifierMutableGlobal { + color: var(--hl-dark-blue-1); + } + .hl-typed-IdentifierParameter { + color: var(--hl-blue); + } + .hl-typed-IdentifierLocal { + color: var(--hl-blue); + } + .hl-typed-IdentifierShadowed { + color: var(--hl-blue); + } + .hl-typed-IdentifierModule { + color: var(--hl-blue); + } + .hl-typed-IdentifierFunction { + color: var(--hl-yellow); + } + .hl-typed-IdentifierFunctionDefinition { + color: var(--hl-yellow); + } + .hl-typed-IdentifierMacro { + color: var(--hl-yellow); + } + .hl-typed-IdentifierMacroDefinition { + color: var(--hl-yellow); + } + .hl-typed-IdentifierType { + color: var(--hl-blue); + } + .hl-typed-IdentifierBuiltinType { + color: var(--hl-blue); + } + .hl-typed-IdentifierAttribute { + color: var(--hl-purple); + } + + // TODO: Followup for https://github.com/sourcegraph/sourcegraph/issues/30995 + // .hl-typed-RegexEscape { + // } + // .hl-typed-RegexRepeated { + // } + // .hl-typed-RegexWildcard { + // } + // .hl-typed-RegexDelimiter { + // } + // .hl-typed-RegexJoin { + // } + + .hl-typed-StringLiteral { + color: var(--hl-red); + } + .hl-typed-StringLiteralEscape { + color: var(--hl-red); + } + .hl-typed-StringLiteralSpecial { + color: var(--hl-red); + } + .hl-typed-StringLiteralKey { + color: var(--hl-red); + } + .hl-typed-CharacterLiteral { + color: var(--hl-red); + } + .hl-typed-NumericLiteral { + color: var(--hl-green-1); + } + + // TODO: Followup for https://github.com/sourcegraph/sourcegraph/issues/30995 + // .hl-typed-Tag { + // } + // .hl-typed-TagAttribute { + // } + // .hl-typed-TagDelimiter { + // } } diff --git a/client/web/src/integration/blob-viewer.test.ts b/client/web/src/integration/blob-viewer.test.ts index 84cb4779ff4e..99cb15648ae6 100644 --- a/client/web/src/integration/blob-viewer.test.ts +++ b/client/web/src/integration/blob-viewer.test.ts @@ -133,6 +133,7 @@ describe('Blob viewer', () => { '' + '// ' + 'Third line\n', + lsif: '', }, }, }, @@ -214,6 +215,7 @@ describe('Blob viewer', () => { 'Hello world' + '"' + ')\n', + lsif: '', }, }, }, @@ -482,6 +484,7 @@ describe('Blob viewer', () => { '' + '// ' + 'Third line\n', + lsif: '', }, }, }, @@ -729,6 +732,7 @@ describe('Blob viewer', () => { '\n' + '
// First word line\n' + '
// Second line
// Third word line
', + lsif: '', }, } : { @@ -741,6 +745,7 @@ describe('Blob viewer', () => { '\n' + '
// First line\n' + '
// Second word line
// Third line
', + lsif: '', }, } @@ -935,6 +940,7 @@ describe('Blob viewer', () => { '"' + ')' + '\n', + lsif: '', lineRanges: [], }, }, diff --git a/client/web/src/integration/graphQlResponseHelpers.ts b/client/web/src/integration/graphQlResponseHelpers.ts index 2e270714baf5..75305c6ede5f 100644 --- a/client/web/src/integration/graphQlResponseHelpers.ts +++ b/client/web/src/integration/graphQlResponseHelpers.ts @@ -41,6 +41,7 @@ export const createBlobContentResult = ( highlight: { aborted: false, html, + lsif: '', }, }, }, diff --git a/client/web/src/lsif/html.ts b/client/web/src/lsif/html.ts new file mode 100644 index 000000000000..d468226aff07 --- /dev/null +++ b/client/web/src/lsif/html.ts @@ -0,0 +1,145 @@ +import { JsonDocument, Occurrence, SyntaxKind } from './lsif-typed' + +class HtmlBuilder { + public readonly buffer: string[] = [] + public plaintext(value: string): void { + if (!value) { + return + } + + this.span('', value) + } + public span(attributes: string, value: string): void { + this.element('span', attributes, value) + } + public element(element: string, attributes: string, value: string): void { + this.openTag(element + ' ' + attributes) + this.raw(value) + this.closeTag(element) + } + public raw(html: string): void { + this.buffer.push(html) + } + public openTag(tag: string): void { + this.buffer.push('<') + this.buffer.push(tag) + this.buffer.push('>') + } + public closeTag(tag: string): void { + this.buffer.push('') + } +} + +function openLine(html: HtmlBuilder, lineNumber: number): void { + html.openTag('tr') + html.raw(``) + + html.openTag('td class="code"') + html.openTag('div') + + // Note: Originally, we passed hl-language for language specific overrides, + // but that seems like a bad plan, so I'm not currently doing that. + // + // We could add this back if we wanted though: + // html.openTag(`span class="hl-source hl-${language}"`) + + html.openTag('span class="hl-source"') +} + +function closeLine(html: HtmlBuilder): void { + html.closeTag('span') + html.closeTag('div') + html.closeTag('td') + html.closeTag('tr') +} + +function highlightSlice(html: HtmlBuilder, kind: SyntaxKind, slice: string): void { + const kindName = SyntaxKind[kind] + if (kindName) { + html.span(`class="hl-typed-${kindName}"`, slice) + } else { + html.plaintext(slice) + } +} + +// Currently assumes that no ranges overlap in the occurences. +export function render(lsif_json: string, content: string): string { + const occurrences = (JSON.parse(lsif_json) as JsonDocument).occurrences.map(occ => new Occurrence(occ)) + + // Sort by line, and then by start character. + occurrences.sort((a, b) => { + if (a.range.start.line !== b.range.start.line) { + return a.range.start.line - b.range.start.line + } + + return a.range.start.character - b.range.start.character + }) + + const lines = content.replaceAll('\r\n', '\n').split('\n') + const html = new HtmlBuilder() + + let occIndex = 0 + + html.openTag('table') + html.openTag('tbody') + for (let lineNumber = 0; lineNumber < lines.length; lineNumber++) { + openLine(html, lineNumber) + + let line = lines[lineNumber] + + let startCharacter = 0 + while (occIndex < occurrences.length && occurrences[occIndex].range.start.line === lineNumber) { + const occ = occurrences[occIndex] + occIndex++ + + const { start, end } = occ.range + + html.plaintext(line.slice(startCharacter, start.character)) + + // For multiline ranges, move the line number forward as we handle the cases. + // This currently assumes that there are no additional matches within this range. + // At this time, the syntax highlighter only returns non-overlapping ranges so this + // is OK. + if (start.line !== end.line) { + html.plaintext(line.slice(start.character)) + closeLine(html) + + // Move to the next line + lineNumber++ + + // Handle all the lines that completely owned by this occurence + while (lineNumber < end.line) { + line = lines[lineNumber] + + openLine(html, lineNumber) + highlightSlice(html, occ.kind, lines[lineNumber]) + closeLine(html) + + lineNumber++ + } + + // Write as much of the line as the last occurence owns + line = lines[lineNumber] + + openLine(html, lineNumber) + highlightSlice(html, occ.kind, line.slice(0, end.character)) + } else { + highlightSlice(html, occ.kind, line.slice(start.character, end.character)) + } + + startCharacter = end.character + } + + // If we didn't find any occurences on this line, then just write the line plainly + if (startCharacter === 0) { + html.plaintext(line) + } + closeLine(html) + } + html.closeTag('tbody') + html.closeTag('table') + + return html.buffer.join('') +} diff --git a/client/web/src/lsif/lsif-typed.ts b/client/web/src/lsif/lsif-typed.ts new file mode 100644 index 000000000000..0c6e52f4b094 --- /dev/null +++ b/client/web/src/lsif/lsif-typed.ts @@ -0,0 +1,128 @@ +// TODO: Eventually we'll import the actual lsif-typed protobuf file in this project, +// but it doesn't make sense to do so right now. + +export interface JsonDocument { + occurrences: JsonOccurrence[] +} + +export interface JsonOccurrence { + range: number[] + syntaxKind: number +} + +export class Position { + constructor(public readonly line: number, public readonly character: number) {} +} + +export class Range { + constructor(public readonly start: Position, public readonly end: Position) {} +} + +export class Occurrence { + public range: Range + public kind: SyntaxKind + + constructor(occ: JsonOccurrence) { + this.range = new Range( + new Position(occ.range[0], occ.range[1]), + // Handle 3 vs 4 length meaning different things + occ.range.length === 3 + ? // 3 means same row + new Position(occ.range[0], occ.range[2]) + : // 4 means could be different rows + new Position(occ.range[2], occ.range[3]) + ) + + this.kind = occ.syntaxKind + } +} + +// This is copy & pasted from the enum defined in lsif.proto. +// Make sure to update it whenever you update lsif.proto +export enum SyntaxKind { + UnspecifiedSyntaxKind = 0, + + // Comment, including comment markers and text + Comment = 1, + + // `,` `.` `,` + PunctuationDelimiter = 2, + // (), {}, [] when used syntactically + PunctuationBracket = 3, + + // `if`, `else`, `return`, `class`, etc. + IdentifierKeyword = 4, + + // `+`, `*`, etc. + IdentifierOperator = 5, + + // non-specific catch-all for any identifier not better described elsewhere + Identifier = 6, + // Identifiers builtin to the language: `min`, `print` in Python. + IdentifierBuiltin = 7, + // Identifiers representing `null`-like values: `None` in Python, `nil` in Go. + IdentifierNull = 8, + // `xyz` in `const xyz = "hello"` + IdentifierConstant = 9, + // `var X = "hello"` in Go + IdentifierMutableGlobal = 10, + // both parameter definition and references + IdentifierParameter = 11, + // identifiers for variable definitions and references within a local scope + IdentifierLocal = 12, + // Used when identifier shadowes some other identifier within the scope + IdentifierShadowed = 13, + // `package main` + IdentifierModule = 14, + + // Function call/reference + IdentifierFunction = 15, + // Function definition only + IdentifierFunctionDefinition = 16, + + // Macro call/reference + IdentifierMacro = 17, + // Macro definition only + IdentifierMacroDefinition = 18, + + // non-builtin types, including namespaces + IdentifierType = 19, + // builtin types only, such as `str` for Python or `int` in Go + IdentifierBuiltinType = 20, + + // Python decorators, c-like __attribute__ + IdentifierAttribute = 21, + + // `\b` + RegexEscape = 22, + // `*`, `+` + RegexRepeated = 23, + // `.` + RegexWildcard = 24, + // `(`, `)`, `[`, `]` + RegexDelimiter = 25, + // `|`, `-` + RegexJoin = 26, + + // Literal strings: "Hello, world!" + StringLiteral = 27, + // non-regex escapes: "\t", "\n" + StringLiteralEscape = 28, + // datetimes within strings, special words within a string, `{}` in format strings + StringLiteralSpecial = 29, + // "key" in { "key": "value" }, useful for example in JSON + StringLiteralKey = 30, + // 'c' or similar, in languages that differentiate strings and characters + CharacterLiteral = 31, + // Literal numbers, both floats and integers + NumericLiteral = 32, + // `true`, `false` + BooleanLiteral = 33, + + // Used for XML-like tags + Tag = 34, + // Attribute name in XML-like tags + TagAttribute = 35, + // Delimiters for XML-like tags + TagDelimiter = 36, +} diff --git a/client/web/src/repo/blob/BlobPage.tsx b/client/web/src/repo/blob/BlobPage.tsx index f51d8b4594ca..ab8ba55787d8 100644 --- a/client/web/src/repo/blob/BlobPage.tsx +++ b/client/web/src/repo/blob/BlobPage.tsx @@ -25,8 +25,10 @@ import { BreadcrumbSetters } from '../../components/Breadcrumbs' import { HeroPage } from '../../components/HeroPage' import { PageTitle } from '../../components/PageTitle' import { GlobalCoolCodeIntelProps } from '../../global/CoolCodeIntel' +import { render as renderLsifHtml } from '../../lsif/html' import { SearchStreamingProps } from '../../search' import { useSearchStack, useExperimentalFeatures } from '../../stores' +import { getExperimentalFeatures } from '../../util/get-experimental-features' import { basename } from '../../util/path' import { toTreeURL } from '../../util/url' import { fetchRepository, resolveRevision } from '../backend' @@ -130,6 +132,9 @@ export const BlobPage: React.FunctionComponent = props => { }, [filePath, revision, repoName, repoUrl, props.telemetryService]) ) + const settings = getExperimentalFeatures(props.settingsCascade.final) + const treeSitterEnabled = !!settings.treeSitterEnabled + // Bundle latest blob with all other file info to pass to `Blob` // Prevents https://github.com/sourcegraph/sourcegraph/issues/14965 by not allowing // components to use current file props while blob hasn't updated, since all information @@ -149,12 +154,19 @@ export const BlobPage: React.FunctionComponent = props => { commitID, filePath, disableTimeout, + treeSitterEnabled, }) ), map(blob => { if (blob === null) { return blob } + + // Replace html with lsif generated HTML, if available + if (blob.highlight.lsif) { + blob.highlight.html = renderLsifHtml(blob.highlight.lsif, blob.content) + } + const blobInfo: BlobInfo & { richHTML: string; aborted: boolean } = { content: blob.content, html: blob.highlight.html, @@ -169,12 +181,9 @@ export const BlobPage: React.FunctionComponent = props => { } return blobInfo }), - catchError((error): [ErrorLike] => { - console.error(error) - return [asError(error)] - }) + catchError((error): [ErrorLike] => [asError(error)]) ), - [repoName, revision, commitID, filePath, mode] + [repoName, revision, commitID, filePath, mode, treeSitterEnabled] ) ) diff --git a/client/web/src/repo/blob/backend.ts b/client/web/src/repo/blob/backend.ts index 2581eb396b7b..2dfaa8fa8163 100644 --- a/client/web/src/repo/blob/backend.ts +++ b/client/web/src/repo/blob/backend.ts @@ -18,10 +18,17 @@ export const fetchBlob = memoizeObservable( commitID: string filePath: string disableTimeout: boolean + treeSitterEnabled: boolean }): Observable => - requestGraphQL( + requestGraphQL( gql` - query Blob($repoName: String!, $commitID: String!, $filePath: String!, $disableTimeout: Boolean!) { + query Blob( + $repoName: String! + $commitID: String! + $filePath: String! + $disableTimeout: Boolean! + $treeSitterEnabled: Boolean! + ) { repository(name: $repoName) { commit(rev: $commitID) { file(path: $filePath) { @@ -34,9 +41,10 @@ export const fetchBlob = memoizeObservable( fragment BlobFileFields on File2 { content richHTML - highlight(disableTimeout: $disableTimeout) { + highlight(disableTimeout: $disableTimeout, treeSitterEnabled: $treeSitterEnabled) { aborted html + lsif } } `, diff --git a/cmd/frontend/graphqlbackend/file.go b/cmd/frontend/graphqlbackend/file.go index a0d226615640..ca6e44e611cb 100644 --- a/cmd/frontend/graphqlbackend/file.go +++ b/cmd/frontend/graphqlbackend/file.go @@ -55,7 +55,7 @@ func (*schemaResolver) HighlightCode(ctx context.Context, args *struct { }) (string, error) { language := highlight.SyntectLanguageMap[strings.ToLower(args.FuzzyLanguage)] filePath := "file." + language - html, _, err := highlight.Code(ctx, highlight.Params{ + html, _, _, err := highlight.Code(ctx, highlight.Params{ Content: []byte(args.Code), Filepath: filePath, DisableTimeout: args.DisableTimeout, diff --git a/cmd/frontend/graphqlbackend/highlight.go b/cmd/frontend/graphqlbackend/highlight.go index 10ac23adee3f..f2aaec151708 100644 --- a/cmd/frontend/graphqlbackend/highlight.go +++ b/cmd/frontend/graphqlbackend/highlight.go @@ -4,6 +4,8 @@ import ( "context" "html/template" + "github.com/gogo/protobuf/jsonpb" + "github.com/sourcegraph/sourcegraph/cmd/frontend/internal/highlight" "github.com/sourcegraph/sourcegraph/internal/search/result" ) @@ -33,15 +35,20 @@ type HighlightArgs struct { DisableTimeout bool IsLightTheme *bool HighlightLongLines bool + TreeSitterEnabled bool } type highlightedFileResolver struct { aborted bool html template.HTML + + // JSON encoded form of lsiftyped.Document + lsif string } func (h *highlightedFileResolver) Aborted() bool { return h.aborted } func (h *highlightedFileResolver) HTML() string { return string(h.html) } +func (h *highlightedFileResolver) LSIF() string { return h.lsif } func (h *highlightedFileResolver) LineRanges(args *struct{ Ranges []highlight.LineRange }) ([][]string, error) { return highlight.SplitLineRanges(h.html, args.Ranges) } @@ -52,14 +59,28 @@ func highlightContent(ctx context.Context, args *HighlightArgs, content, path st err error simulateTimeout = metadata.RepoName == "github.com/sourcegraph/AlwaysHighlightTimeoutTest" ) - result.html, result.aborted, err = highlight.Code(ctx, highlight.Params{ + + html, document, aborted, err := highlight.Code(ctx, highlight.Params{ Content: []byte(content), Filepath: path, DisableTimeout: args.DisableTimeout, HighlightLongLines: args.HighlightLongLines, SimulateTimeout: simulateTimeout, Metadata: metadata, + TreeSitterEnabled: args.TreeSitterEnabled, }) + result.html = html + result.aborted = aborted + + if document != nil { + marshaller := &jsonpb.Marshaler{ + EnumsAsInts: true, + EmitDefaults: false, + } + + result.lsif, err = marshaller.MarshalToString(document) + } + if err != nil { return nil, err } diff --git a/cmd/frontend/graphqlbackend/repository_comparison_test.go b/cmd/frontend/graphqlbackend/repository_comparison_test.go index a3e93298ad4e..c8316981d1b0 100644 --- a/cmd/frontend/graphqlbackend/repository_comparison_test.go +++ b/cmd/frontend/graphqlbackend/repository_comparison_test.go @@ -20,6 +20,7 @@ import ( "github.com/sourcegraph/sourcegraph/internal/gitserver/gitdomain" "github.com/sourcegraph/sourcegraph/internal/types" "github.com/sourcegraph/sourcegraph/internal/vcs/git" + "github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped" "github.com/sourcegraph/sourcegraph/lib/errors" ) @@ -718,14 +719,14 @@ func TestFileDiffHighlighter(t *testing.T) {
new2
new3
` - highlight.Mocks.Code = func(p highlight.Params) (template.HTML, bool, error) { + highlight.Mocks.Code = func(p highlight.Params) (template.HTML, *lsiftyped.Document, bool, error) { switch p.Filepath { case file1.path: - return template.HTML(highlightedOld), false, nil + return template.HTML(highlightedOld), nil, false, nil case file2.path: - return template.HTML(highlightedNew), false, nil + return template.HTML(highlightedNew), nil, false, nil default: - return "", false, errors.Errorf("unknown file: %s", p.Filepath) + return "", nil, false, errors.Errorf("unknown file: %s", p.Filepath) } } t.Cleanup(highlight.ResetMocks) diff --git a/cmd/frontend/graphqlbackend/schema.graphql b/cmd/frontend/graphqlbackend/schema.graphql index 8a2aaf9f573b..9381e78ac198 100755 --- a/cmd/frontend/graphqlbackend/schema.graphql +++ b/cmd/frontend/graphqlbackend/schema.graphql @@ -3134,6 +3134,7 @@ type FileDiffHunk { rendering efficiently. """ highlightLongLines: Boolean = false + treeSitterEnabled: Boolean = false ): HighlightedDiffHunkBody! } @@ -4134,6 +4135,8 @@ interface File2 { rendering efficiently. """ highlightLongLines: Boolean = false + + treeSitterEnabled: Boolean = false ): HighlightedFile! } @@ -4197,6 +4200,7 @@ type VirtualFile implements File2 { rendering efficiently. """ highlightLongLines: Boolean = false + treeSitterEnabled: Boolean = false ): HighlightedFile! } @@ -4298,6 +4302,7 @@ type GitBlob implements TreeEntry & File2 { rendering efficiently. """ highlightLongLines: Boolean = false + treeSitterEnabled: Boolean = false ): HighlightedFile! """ Submodule metadata if this tree points to a submodule @@ -4361,6 +4366,10 @@ type HighlightedFile { """ html: String! """ + Base64 encoded JSON payload of LSIF Typed with syntax highlighting data. + """ + lsif: String! + """ A list of the desired line ranges. Each list is a list of lines, where each element is an HTML table row '...' string. This is useful if you only need to display specific subsets of the file. diff --git a/cmd/frontend/graphqlbackend/virtual_file_test.go b/cmd/frontend/graphqlbackend/virtual_file_test.go index dde9c99f3ef7..558565bda481 100644 --- a/cmd/frontend/graphqlbackend/virtual_file_test.go +++ b/cmd/frontend/graphqlbackend/virtual_file_test.go @@ -9,6 +9,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/sourcegraph/sourcegraph/cmd/frontend/internal/highlight" + "github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped" ) func TestVirtualFile(t *testing.T) { @@ -76,8 +77,8 @@ func TestVirtualFile(t *testing.T) { t.Run("Highlight", func(t *testing.T) { testHighlight := func(aborted bool) { highlightedContent := template.HTML("highlight of the file") - highlight.Mocks.Code = func(p highlight.Params) (template.HTML, bool, error) { - return highlightedContent, aborted, nil + highlight.Mocks.Code = func(p highlight.Params) (template.HTML, *lsiftyped.Document, bool, error) { + return highlightedContent, nil, aborted, nil } t.Cleanup(highlight.ResetMocks) highlightedFile, err := vfr.Highlight(context.Background(), &HighlightArgs{}) diff --git a/cmd/frontend/internal/highlight/highlight.go b/cmd/frontend/internal/highlight/highlight.go index 9d8435399a4c..81963aa0d058 100644 --- a/cmd/frontend/internal/highlight/highlight.go +++ b/cmd/frontend/internal/highlight/highlight.go @@ -3,6 +3,7 @@ package highlight import ( "bytes" "context" + "encoding/base64" "fmt" "html/template" "net/http" @@ -12,25 +13,29 @@ import ( "time" "unicode/utf8" + "github.com/go-enry/go-enry/v2" "github.com/inconshreveable/log15" otlog "github.com/opentracing/opentracing-go/log" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/sourcegraph/gosyntect" "golang.org/x/net/html" "golang.org/x/net/html/atom" + "google.golang.org/protobuf/proto" "github.com/sourcegraph/sourcegraph/internal/env" + "github.com/sourcegraph/sourcegraph/internal/gosyntect" "github.com/sourcegraph/sourcegraph/internal/honey" "github.com/sourcegraph/sourcegraph/internal/observation" "github.com/sourcegraph/sourcegraph/internal/trace/ot" + "github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped" "github.com/sourcegraph/sourcegraph/lib/errors" ) var ( syntectServer = env.Get("SRC_SYNTECT_SERVER", "http://syntect-server:9238", "syntect_server HTTP(s) address") client *gosyntect.Client - highlightOp *observation.Operation + + highlightOp *observation.Operation ) func init() { @@ -85,6 +90,11 @@ type Params struct { // respond. SimulateTimeout bool + // Whether to use tree-sitter to power syntax highlighting instead of + // syntect (default). Tree-sitter support is only available for a small + // number of programming languages. + TreeSitterEnabled bool + // Metadata provides optional metadata about the code we're highlighting. Metadata Metadata } @@ -111,7 +121,7 @@ var ErrBinary = errors.New("cannot render binary file") // to timeout. In this scenario, a plain text table is returned. // // In the event the input content is binary, ErrBinary is returned. -func Code(ctx context.Context, p Params) (h template.HTML, aborted bool, err error) { +func Code(ctx context.Context, p Params) (h template.HTML, l *lsiftyped.Document, aborted bool, err error) { if Mocks.Code != nil { return Mocks.Code(p) } @@ -124,6 +134,7 @@ func Code(ctx context.Context, p Params) (h template.HTML, aborted bool, err err otlog.Int("sizeBytes", len(p.Content)), otlog.Bool("highlightLongLines", p.HighlightLongLines), otlog.Bool("disableTimeout", p.DisableTimeout), + otlog.Bool("treeSitterEnabled", p.TreeSitterEnabled), }}) defer endObservation(1, observation.Args{}) @@ -151,7 +162,7 @@ func Code(ctx context.Context, p Params) (h template.HTML, aborted bool, err err // Never pass binary files to the syntax highlighter. if IsBinary(p.Content) { - return "", false, ErrBinary + return "", nil, false, ErrBinary } code := string(p.Content) @@ -182,19 +193,24 @@ func Code(ctx context.Context, p Params) (h template.HTML, aborted bool, err err p.Filepath = normalizeFilepath(p.Filepath) + filetype := enry.GetLanguage(p.Filepath, []byte(code)) + useTreeSitter := p.TreeSitterEnabled && client.IsTreesitterSupported(filetype) + resp, err := client.Highlight(ctx, &gosyntect.Query{ Code: code, Filepath: p.Filepath, + Filetype: filetype, StabilizeTimeout: stabilizeTimeout, Tracer: ot.GetTracer(ctx), LineLengthLimit: maxLineLength, CSS: true, - }) + }, useTreeSitter) if ctx.Err() == context.DeadlineExceeded { log15.Warn( "syntax highlighting took longer than 3s, this *could* indicate a bug in Sourcegraph", "filepath", p.Filepath, + "filetype", filetype, "repo_name", p.Metadata.RepoName, "revision", p.Metadata.Revision, "snippet", fmt.Sprintf("%q…", firstCharacters(code, 80)), @@ -204,11 +220,12 @@ func Code(ctx context.Context, p Params) (h template.HTML, aborted bool, err err // Timeout, so render plain table. table, err := generatePlainTable(code) - return table, true, err + return table, nil, true, err } else if err != nil { log15.Error( "syntax highlighting failed (this is a bug, please report it)", "filepath", p.Filepath, + "filetype", filetype, "repo_name", p.Metadata.RepoName, "revision", p.Metadata.Revision, "snippet", fmt.Sprintf("%q…", firstCharacters(code, 80)), @@ -238,12 +255,25 @@ func Code(ctx context.Context, p Params) (h template.HTML, aborted bool, err err errCollector.Collect(&err) prometheusStatus = problem table, err := generatePlainTable(code) - return table, false, err + return table, nil, false, err + } + return "", nil, false, err + } + + if useTreeSitter { + document := new(lsiftyped.Document) + data, err := base64.StdEncoding.DecodeString(resp.Data) + if err != nil { + return "", nil, false, err + } + err = proto.Unmarshal(data, document) + if err != nil { + return "", nil, false, err } - return "", false, err + return "", document, false, nil } - return template.HTML(resp.Data), false, nil + return template.HTML(resp.Data), nil, false, nil } // TODO (Dax): Determine if Histogram provides value and either use only histogram or counter, not both @@ -305,7 +335,7 @@ func generatePlainTable(code string) (template.HTML, error) { // // In the event the input content is binary, ErrBinary is returned. func CodeAsLines(ctx context.Context, p Params) ([]template.HTML, bool, error) { - html, aborted, err := Code(ctx, p) + html, _, aborted, err := Code(ctx, p) if err != nil { return nil, aborted, err } diff --git a/cmd/frontend/internal/highlight/highlight_test.go b/cmd/frontend/internal/highlight/highlight_test.go index daca905822d2..c6861d2a5f19 100644 --- a/cmd/frontend/internal/highlight/highlight_test.go +++ b/cmd/frontend/internal/highlight/highlight_test.go @@ -2,12 +2,37 @@ package highlight import ( "context" + "encoding/base64" "html/template" "testing" "github.com/google/go-cmp/cmp" + "google.golang.org/protobuf/proto" + + "github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped" ) +func TestDeserialize(t *testing.T) { + original := new(lsiftyped.Document) + original.Occurrences = append(original.Occurrences, &lsiftyped.Occurrence{ + SyntaxKind: lsiftyped.SyntaxKind_IdentifierAttribute, + }) + + marshaled, _ := proto.Marshal(original) + data, _ := base64.StdEncoding.DecodeString(base64.StdEncoding.EncodeToString(marshaled)) + + roundtrip := new(lsiftyped.Document) + err := proto.Unmarshal(data, roundtrip) + + if err != nil { + t.Fatal(err) + } + + if diff := cmp.Diff(original.String(), roundtrip.String()); diff != "" { + t.Fatalf("Round trip encode and decode should return the same data: %s", diff) + } +} + func TestGeneratePlainTable(t *testing.T) { input := `line 1 line 2 @@ -84,8 +109,8 @@ line3` highlightedCode := `
line 1
line 2
line 3
` - Mocks.Code = func(p Params) (h template.HTML, aborted bool, err error) { - return template.HTML(highlightedCode), false, nil + Mocks.Code = func(p Params) (h template.HTML, l *lsiftyped.Document, aborted bool, err error) { + return template.HTML(highlightedCode), nil, false, nil } t.Cleanup(ResetMocks) diff --git a/cmd/frontend/internal/highlight/mocks.go b/cmd/frontend/internal/highlight/mocks.go index 2930b85e38ce..febfdca56f24 100644 --- a/cmd/frontend/internal/highlight/mocks.go +++ b/cmd/frontend/internal/highlight/mocks.go @@ -2,6 +2,8 @@ package highlight import ( "html/template" + + "github.com/sourcegraph/sourcegraph/lib/codeintel/lsiftyped" ) // Mocks is used to mock behavior in tests. Tests must call ResetMocks() when finished to ensure its @@ -9,7 +11,7 @@ import ( // // (The emptyMocks is used by ResetMocks to zero out Mocks without needing to use a named type.) var Mocks, emptyMocks struct { - Code func(p Params) (h template.HTML, aborted bool, err error) + Code func(p Params) (h template.HTML, l *lsiftyped.Document, aborted bool, err error) } // ResetMocks clears the mock functions set on Mocks (so that subsequent tests don't inadvertently diff --git a/cmd/frontend/internal/search/decorate.go b/cmd/frontend/internal/search/decorate.go index edbef8ade68c..9b5788abb7ac 100644 --- a/cmd/frontend/internal/search/decorate.go +++ b/cmd/frontend/internal/search/decorate.go @@ -101,7 +101,7 @@ func DecorateFileHTML(ctx context.Context, repo api.RepoName, commit api.CommitI if err != nil { return "", err } - result, aborted, err := highlight.Code(ctx, highlight.Params{ + result, _, aborted, err := highlight.Code(ctx, highlight.Params{ Content: content, Filepath: path, DisableTimeout: false, // use default 3 second timeout diff --git a/dev/check/go-lint.sh b/dev/check/go-lint.sh index 09506af88795..e71515167524 100755 --- a/dev/check/go-lint.sh +++ b/dev/check/go-lint.sh @@ -35,9 +35,24 @@ run() { fi } + +# Used to ignore directories (for example, when using submodules) +# (It appears to be unused, but it's actually used doing -v below) +# +# shellcheck disable=SC2034 +declare -A IGNORED_DIRS=( + ["./docker-images/syntax-highlighter"]=1 +) + # If no args are given, traverse through each project with a `go.mod` if [ $# -eq 0 ]; then find . -name go.mod -exec dirname '{}' \; | while read -r d; do + + # Skip any ignored directories. + if [ -v "IGNORED_DIRS[$d]" ] ; then + continue + fi + pushd "$d" >/dev/null echo "--- golangci-lint $d" diff --git a/dev/check/gofmt.sh b/dev/check/gofmt.sh index bc1ff1f76ff0..a16afe1570b5 100755 --- a/dev/check/gofmt.sh +++ b/dev/check/gofmt.sh @@ -8,7 +8,17 @@ cd "$(dirname "${BASH_SOURCE[0]}")/../.." # Check if all code is gofmt'd -DIFF=$(find . \( -path ./vendor -o -path ./vendored \) -prune -o -name '*.go' -exec gofmt -s -w -d {} +) +# IGNORE: +# vendored: Vendored code doesn't matter for gofmt +# syntax-highlighter/crates: has embedded go test files + +DIFF=$( + find . \( \ + -path ./vendor \ + -o -path ./vendored \ + -o -path ./docker-images/syntax-highlighter/crates/sg-syntax/languages/tree-sitter-go \ + \) -prune -o -name '*.go' -exec gofmt -s -w -d {} + +) if [ -z "$DIFF" ]; then echo "Success: gofmt check passed." exit 0 diff --git a/dev/check/shellcheck.sh b/dev/check/shellcheck.sh index b528c5c6c12a..d50dcec56edc 100755 --- a/dev/check/shellcheck.sh +++ b/dev/check/shellcheck.sh @@ -10,7 +10,7 @@ cd "$(dirname "${BASH_SOURCE[0]}")"/../.. SHELL_SCRIPTS=() -while IFS='' read -r line; do SHELL_SCRIPTS+=("$line"); done < <(shfmt -f .) +while IFS='' read -r line; do SHELL_SCRIPTS+=("$line"); done < <(comm -12 <(git ls-files | sort) <(shfmt -f . | sort)) set +e OUT=$(shellcheck --external-sources --source-path="SCRIPTDIR" --color=always "${SHELL_SCRIPTS[@]}") diff --git a/dev/check/shfmt.sh b/dev/check/shfmt.sh index 51c91026d425..3666799b3b26 100755 --- a/dev/check/shfmt.sh +++ b/dev/check/shfmt.sh @@ -6,7 +6,14 @@ set -e cd "$(dirname "${BASH_SOURCE[0]}")"/../.. set +e -OUT=$(shfmt -d .) + +# Ignore scripts in submodules +# +# Following command uses `git ls-files` to make sure we have only files that +# are in our repository, and then `shfmt -f .` to find the shell scripts. +# +# `comm` is used to find the common items between the two +OUT=$(comm -12 <(git ls-files | sort) <(shfmt -f . | sort) | shfmt -d) EXIT_CODE=$? set -e echo -e "$OUT" diff --git a/dev/ci/go-backcompat/test.sh b/dev/ci/go-backcompat/test.sh index 993c1111cba5..0346f5653e64 100755 --- a/dev/ci/go-backcompat/test.sh +++ b/dev/ci/go-backcompat/test.sh @@ -103,6 +103,10 @@ go run ./dev/ci/go-backcompat/reorganize.go "${MIGRATION_STAGING}" git checkout "${latest_minor_release_tag}" git checkout "${current_head}" -- "${PROTECTED_FILES[@]}" +# Remove the languages submodules, because they mess these tests up +rm -rf ./docker-images/syntax-highlighter/crates/sg-syntax/languages/ + + for schema in frontend codeintel codeinsights; do # Force apply newer schema definitions rm -rf "./migrations/${schema}" diff --git a/dev/ci/go-test.sh b/dev/ci/go-test.sh index 8fcb11cd3287..4af374a1be18 100755 --- a/dev/ci/go-test.sh +++ b/dev/ci/go-test.sh @@ -123,8 +123,23 @@ export NO_GRAPHQL_LOG=true go install github.com/kyoh86/richgo@latest asdf reshim golang + +# Used to ignore directories (for example, when using submodules) +# (It appears to be unused, but it's actually used doing -v below) +# +# shellcheck disable=SC2034 +declare -A IGNORED_DIRS=( + ["./docker-images/syntax-highlighter"]=1 +) + # We have multiple go.mod files and go list doesn't recurse into them. find . -name go.mod -exec dirname '{}' \; | while read -r d; do + + # Skip any ignored directories. + if [ -v "IGNORED_DIRS[$d]" ] ; then + continue + fi + pushd "$d" >/dev/null # Separate out time for go mod from go test diff --git a/dev/generate.sh b/dev/generate.sh index 4c1de2a99bda..92befc9409ec 100755 --- a/dev/generate.sh +++ b/dev/generate.sh @@ -6,5 +6,16 @@ cd "$(dirname "${BASH_SOURCE[0]}")/.." # cd to repo root dir # We'll exclude generating the CLI reference documentation by default due to the # relatively high cost of fetching and building src-cli. go list ./... | grep -v 'doc/cli/references' | xargs go generate -x -GOBIN="$PWD/.bin" go install golang.org/x/tools/cmd/goimports && ./.bin/goimports -w . + +# Ignore the submodules in docker-images syntax-highlighter. +# +# Disable shellcheck for this line because we actually want them to be space separated +# (goimports doesn't accept passing args by stdin) +# +# shellcheck disable=SC2046 +GOBIN="$PWD/.bin" go install golang.org/x/tools/cmd/goimports && \ + ./.bin/goimports -w $( + comm -12 <(git ls-files | sort) <(find . -type f -name '*.go' -printf "%P\n" | sort) + ) + go mod tidy diff --git a/dev/proto-generate.sh b/dev/proto-generate.sh index f74736db5bae..402cf911db65 100755 --- a/dev/proto-generate.sh +++ b/dev/proto-generate.sh @@ -8,6 +8,9 @@ echo "--- yarn in root" # mutex is necessary since CI runs various yarn installs in parallel yarn --mutex network --frozen-lockfile --network-timeout 60000 +echo "--- cargo install rust-protobuf" +which ./.bin/bin/protoc-gen-rust || cargo install --root .bin protobuf-codegen + echo "--- buf" GOBIN="$PWD/.bin" go install github.com/bufbuild/buf/cmd/buf @@ -17,3 +20,8 @@ GOBIN="$PWD/.bin" go install google.golang.org/protobuf/cmd/protoc-gen-go GOBIN="$PWD/.bin" ./.bin/buf generate ./.bin/goimports -w ./lib/codeintel/lsiftyped/lsif.pb.go + +echo "======================" +echo "NOTE:" +echo "If updating SyntaxKind, make sure to update: client/web/src/lsif/spec.ts" +echo "======================" diff --git a/docker-images/syntax-highlighter/.gitignore b/docker-images/syntax-highlighter/.gitignore index eb5a316cbd19..bf937054fdb1 100644 --- a/docker-images/syntax-highlighter/.gitignore +++ b/docker-images/syntax-highlighter/.gitignore @@ -1 +1,2 @@ target +languages/libraries/ diff --git a/docker-images/syntax-highlighter/Cargo.lock b/docker-images/syntax-highlighter/Cargo.lock index 9b432e9ff9de..7a94d4389af9 100644 --- a/docker-images/syntax-highlighter/Cargo.lock +++ b/docker-images/syntax-highlighter/Cargo.lock @@ -4,75 +4,60 @@ version = 3 [[package]] name = "adler" -version = "0.2.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] -name = "aead" -version = "0.3.2" +name = "aho-corasick" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" dependencies = [ - "generic-array", + "memchr", ] [[package]] -name = "aes" -version = "0.4.0" +name = "ansi_term" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7001367fde4c768a19d1029f0a8be5abd9308e1119846d5bd9ad26297b8faf5" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "aes-soft", - "aesni", - "block-cipher", + "winapi", ] [[package]] -name = "aes-gcm" -version = "0.6.0" +name = "anyhow" +version = "1.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f5007801316299f922a6198d1d09a0bae95786815d066d5880d13f7c45ead1" -dependencies = [ - "aead", - "aes", - "block-cipher", - "ghash", - "subtle", -] +checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0" [[package]] -name = "aes-soft" -version = "0.4.0" +name = "async-stream" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4925647ee64e5056cf231608957ce7c81e12d6d6e316b9ce1404778cc1d35fa7" +checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" dependencies = [ - "block-cipher", - "byteorder", - "opaque-debug 0.2.3", + "async-stream-impl", + "futures-core", ] [[package]] -name = "aesni" -version = "0.7.0" +name = "async-stream-impl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050d39b0b7688b3a3254394c3e30a9d66c41dcf9b05b0e2dbdc623f6505d264" +checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" dependencies = [ - "block-cipher", - "opaque-debug 0.2.3", + "proc-macro2", + "quote", + "syn", ] -[[package]] -name = "arc-swap" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" - [[package]] name = "async-trait" -version = "0.1.41" +version = "0.1.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b246867b8b3b6ae56035f1eb1ed557c1d8eae97f0d53696138a50fa0e3a3b8c0" +checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3" dependencies = [ "proc-macro2", "quote", @@ -81,9 +66,9 @@ dependencies = [ [[package]] name = "atomic" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3410529e8288c463bedb5930f82833bc0c90e5d2fe639a56582a4d09220b281" +checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" dependencies = [ "autocfg", ] @@ -96,7 +81,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -105,17 +90,11 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "base-x" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b20b618342cf9891c292c4f5ac2cde7287cc5c87e87e9c769d617793607dec1" - [[package]] name = "base64" -version = "0.12.3" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "binascii" @@ -125,237 +104,168 @@ checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72" [[package]] name = "bincode" -version = "1.3.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" dependencies = [ - "byteorder", "serde", ] [[package]] name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-cipher" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa136449e765dc7faa244561ccae839c394048667929af599b5d931ebe7b7f10" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bumpalo" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" - -[[package]] -name = "byteorder" -version = "1.3.4" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bytes" -version = "0.5.6" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "cc" -version = "1.0.60" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c" +checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" [[package]] name = "cfg-if" -version = "0.1.10" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "chrono" -version = "0.4.19" +name = "console" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +checksum = "a28b32d32ca44b70c3e4acd7db1babf555fa026e385fb95f18028f88848b3c31" dependencies = [ - "num-integer", - "num-traits", + "encode_unicode", + "libc", + "once_cell", + "terminal_size", + "winapi", ] -[[package]] -name = "const_fn" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2" - [[package]] name = "cookie" -version = "0.15.0-dev" -source = "git+https://github.com/SergioBenitez/cookie-rs.git?rev=3795f2e#3795f2e63dc82e37923f2fd36c6450ff63851af2" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94d4706de1b0fa5b132270cddffa8585166037822e260a944fe161acd137ca05" dependencies = [ - "aes-gcm", - "base64", - "dashmap", - "hkdf", "percent-encoding", - "rand", - "sha2", "time", "version_check", ] -[[package]] -name = "cpuid-bool" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" - [[package]] name = "crc32fast" -version = "1.2.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +checksum = "a2209c310e29876f7f0b2721e7e26b84aff178aa3da5d091f9bfbf47669e60e3" dependencies = [ "cfg-if", ] [[package]] -name = "crossbeam-channel" -version = "0.4.4" +name = "ctor" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" +checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa" dependencies = [ - "crossbeam-utils", - "maybe-uninit", + "quote", + "syn", ] [[package]] -name = "crossbeam-deque" -version = "0.7.3" +name = "devise" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" +checksum = "50c7580b072f1c8476148f16e0a0d5dedddab787da98d86c5082c5e9ed8ab595" dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", - "maybe-uninit", + "devise_codegen", + "devise_core", ] [[package]] -name = "crossbeam-epoch" -version = "0.8.2" +name = "devise_codegen" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +checksum = "123c73e7a6e51b05c75fe1a1b2f4e241399ea5740ed810b0e3e6cacd9db5e7b2" dependencies = [ - "autocfg", - "cfg-if", - "crossbeam-utils", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard", + "devise_core", + "quote", ] [[package]] -name = "crossbeam-utils" -version = "0.7.2" +name = "devise_core" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +checksum = "841ef46f4787d9097405cac4e70fb8644fc037b526e8c14054247c0263c400d0" dependencies = [ - "autocfg", - "cfg-if", - "lazy_static", + "bitflags", + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "syn", ] [[package]] -name = "crypto-mac" -version = "0.8.0" +name = "diff" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array", - "subtle", -] +checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499" [[package]] -name = "dashmap" -version = "4.0.0-rc6" +name = "either" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308a6703be2d759cb5fb7b80a23547fe73a8d5ebf70d3a4ca7f0ef4c0bfc2265" -dependencies = [ - "once_cell", -] +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] -name = "devise" -version = "0.3.0" -source = "git+https://github.com/SergioBenitez/Devise.git?rev=1e42a2691#1e42a2691ef9934a446b8ed0ca1c4c8cf283f8bf" -dependencies = [ - "devise_codegen", - "devise_core", -] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] -name = "devise_codegen" -version = "0.3.0" -source = "git+https://github.com/SergioBenitez/Devise.git?rev=1e42a2691#1e42a2691ef9934a446b8ed0ca1c4c8cf283f8bf" +name = "encoding_rs" +version = "0.8.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dc8abb250ffdda33912550faa54c88ec8b998dec0b2c55ab224921ce11df" dependencies = [ - "devise_core", - "quote", + "cfg-if", ] [[package]] -name = "devise_core" -version = "0.3.0" -source = "git+https://github.com/SergioBenitez/Devise.git?rev=1e42a2691#1e42a2691ef9934a446b8ed0ca1c4c8cf283f8bf" +name = "fastrand" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" dependencies = [ - "bitflags", - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "syn", + "instant", ] [[package]] -name = "digest" -version = "0.9.0" +name = "figment" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +checksum = "790b4292c72618abbab50f787a477014fe15634f96291de45672ce46afe122df" dependencies = [ - "generic-array", + "atomic", + "pear", + "serde", + "toml", + "uncased", + "version_check", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - [[package]] name = "flate2" -version = "1.0.18" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da80be589a72651dcda34d8b35bcdc9b7254ad06325611074d9cc0fbb19f60ee" +checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" dependencies = [ "cfg-if", "crc32fast", @@ -369,31 +279,14 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "futures" -version = "0.3.6" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d8e3078b7b2a8a671cb7a3d17b4760e4181ea243227776ba83fd043b4ca034e" +checksum = "28560757fe2bb34e79f907794bb6b22ae8b0e5c669b638a1132f2592b19035b4" dependencies = [ "futures-channel", "futures-core", - "futures-executor", "futures-io", "futures-sink", "futures-task", @@ -402,9 +295,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.6" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a4d35f7401e948629c9c3d6638fb9bf94e0b2121e96c3b428cc4e631f3eb74" +checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b" dependencies = [ "futures-core", "futures-sink", @@ -412,104 +305,69 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d674eaa0056896d5ada519900dbf97ead2e46a7b6621e8160d79e2f2e1e2784b" - -[[package]] -name = "futures-executor" -version = "0.3.6" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc709ca1da6f66143b8c9bec8e6260181869893714e9b5a490b169b0414144ab" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] +checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" [[package]] name = "futures-io" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc94b64bb39543b4e432f1790b6bf18e3ee3b74653c5449f63310e9a74b123c" - -[[package]] -name = "futures-macro" -version = "0.3.6" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f57ed14da4603b2554682e9f2ff3c65d7567b53188db96cb71538217fc64581b" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "syn", -] +checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2" [[package]] name = "futures-sink" -version = "0.3.6" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8764258ed64ebc5d9ed185cf86a95db5cac810269c5d20ececb32e0088abbd" +checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508" [[package]] name = "futures-task" -version = "0.3.6" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd26820a9f3637f1302da8bceba3ff33adbe53464b54ca24d4e2d4f1db30f94" -dependencies = [ - "once_cell", -] +checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72" [[package]] name = "futures-util" -version = "0.3.6" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a894a0acddba51a2d49a6f4263b1e64b8c579ece8af50fa86503d52cd1eea34" +checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164" dependencies = [ "futures-channel", "futures-core", "futures-io", - "futures-macro", "futures-sink", "futures-task", "memchr", - "pin-project", + "pin-project-lite", "pin-utils", - "proc-macro-hack", - "proc-macro-nested", "slab", ] [[package]] -name = "generic-array" -version = "0.14.4" +name = "generator" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +checksum = "c1d9279ca822891c1a4dae06d185612cf8fc6acfe5dff37781b41297811b12ee" dependencies = [ - "typenum", - "version_check", + "cc", + "libc", + "log", + "rustversion", + "winapi", ] [[package]] name = "getrandom" -version = "0.1.15" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" dependencies = [ "cfg-if", "libc", "wasi", ] -[[package]] -name = "ghash" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6e27f0689a6e15944bdce7e45425efb87eaa8ab0c6e87f11d0987a9133e2531" -dependencies = [ - "polyval", -] - [[package]] name = "glob" version = "0.3.0" @@ -518,9 +376,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "h2" -version = "0.2.6" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" +checksum = "d9f1f717ddc7b2ba36df7e871fd88db79326551d3d6f1fc406fbfd28b582ff8e" dependencies = [ "bytes", "fnv", @@ -537,77 +395,58 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.9.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "hermit-abi" -version = "0.1.17" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] -[[package]] -name = "hkdf" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe1149865383e4526a43aee8495f9a325f0b806c63ce6427d06336a590abbbc9" -dependencies = [ - "digest", - "hmac", -] - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac", - "digest", -] - [[package]] name = "http" -version = "0.2.1" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" +checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" dependencies = [ "bytes", "fnv", - "itoa", + "itoa 1.0.1", ] [[package]] name = "http-body" -version = "0.3.1" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" dependencies = [ "bytes", "http", + "pin-project-lite", ] [[package]] name = "httparse" -version = "1.3.4" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" [[package]] name = "httpdate" -version = "0.3.2" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.13.8" +version = "0.14.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f3afcfae8af5ad0576a31e768415edb627824129e8e5a29b8bfccb2f234e835" +checksum = "b7ec3e62bdc98a2f0393a5048e4c30ef659440ea6e0e572965103e72bd836f55" dependencies = [ "bytes", "futures-channel", @@ -618,8 +457,9 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa", - "pin-project", + "itoa 0.4.8", + "pin-project-lite", + "socket2", "tokio", "tower-service", "tracing", @@ -628,44 +468,55 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" +checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" dependencies = [ "autocfg", "hashbrown", + "serde", ] [[package]] name = "inlinable_string" -version = "0.1.11" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6ee2a7da03bfc3b66ca47c92c2e392fcc053ea040a85561749b026f7aad09a" +checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb" [[package]] -name = "iovec" -version = "0.1.4" +name = "insta" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +checksum = "f4c0c443f6dceb3a1cb7607c87501aa91e4b9c976044f725c2a74ca2152c91a4" dependencies = [ - "libc", + "console", + "once_cell", + "serde", + "serde_json", + "serde_yaml", + "similar", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", ] [[package]] name = "itoa" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] -name = "kernel32-sys" -version = "0.2.2" +name = "itoa" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" [[package]] name = "lazy_static" @@ -681,9 +532,19 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.79" +version = "0.2.115" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a8d982fa7a96a000f6ec4cfe966de9703eccde29750df2bb8949da91b0e818d" + +[[package]] +name = "libloading" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743" +checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" +dependencies = [ + "cfg-if", + "winapi", +] [[package]] name = "line-wrap" @@ -696,40 +557,58 @@ dependencies = [ [[package]] name = "linked-hash-map" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" +checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] -name = "log" -version = "0.4.11" +name = "lock_api" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" dependencies = [ - "cfg-if", + "scopeguard", ] [[package]] -name = "maybe-uninit" -version = "2.0.0" +name = "log" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if", +] [[package]] -name = "memchr" -version = "2.3.3" +name = "loom" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" +checksum = "edc5c7d328e32cc4954e8e01193d7f0ef5ab257b5090b70a964e099a36034309" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", + "serde", + "serde_json", + "tracing", + "tracing-subscriber", +] [[package]] -name = "memoffset" -version = "0.5.6" +name = "matchers" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "autocfg", + "regex-automata", ] +[[package]] +name = "memchr" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" + [[package]] name = "mime" version = "0.3.16" @@ -738,9 +617,9 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" [[package]] name = "miniz_oxide" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c60c0dfe32c10b43a144bad8fc83538c52f58302c92300ea7ec7bf7b38d5a7b9" +checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" dependencies = [ "adler", "autocfg", @@ -748,97 +627,85 @@ dependencies = [ [[package]] name = "mio" -version = "0.6.22" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" +checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" dependencies = [ - "cfg-if", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", "libc", "log", "miow", - "net2", - "slab", - "winapi 0.2.8", + "ntapi", + "winapi", ] [[package]] -name = "mio-uds" -version = "0.6.8" +name = "miow" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "iovec", - "libc", - "mio", + "winapi", ] [[package]] -name = "miow" -version = "0.2.1" +name = "multer" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +checksum = "5f8f35e687561d5c1667590911e6698a8cb714a134a7505718a182e7bc9d3836" dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "net2" -version = "0.2.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" -dependencies = [ - "cfg-if", - "libc", - "winapi 0.3.9", + "bytes", + "encoding_rs", + "futures-util", + "http", + "httparse", + "log", + "memchr", + "mime", + "spin", + "tokio", + "tokio-util", + "version_check", ] [[package]] -name = "num-integer" -version = "0.1.43" +name = "ntapi" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ - "autocfg", - "num-traits", + "winapi", ] [[package]] -name = "num-traits" -version = "0.2.12" +name = "num_cpus" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ - "autocfg", + "hermit-abi", + "libc", ] [[package]] -name = "num_cpus" -version = "1.13.0" +name = "num_threads" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "97ba99ba6393e2c3734791401b66902d981cb03bf190af674ca69949b6d5fb15" dependencies = [ - "hermit-abi", "libc", ] [[package]] name = "once_cell" -version = "1.4.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" +checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" [[package]] name = "onig" -version = "6.1.0" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a155d13862da85473665694f4c05d77fb96598bdceeaf696433c84ea9567e20" +checksum = "67ddfe2c93bb389eea6e6d713306880c7f6dcc99a75b659ce145d962c861b225" dependencies = [ "bitflags", "lazy_static", @@ -848,30 +715,59 @@ dependencies = [ [[package]] name = "onig_sys" -version = "69.5.1" +version = "69.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bff06597a6b17855040955cae613af000fc0bfc8ad49ea68b9479a74e59292d" +checksum = "5dd3eee045c84695b53b20255bb7317063df090b68e18bfac0abb6c39cf7f33e" dependencies = [ "cc", "pkg-config", ] [[package]] -name = "opaque-debug" -version = "0.2.3" +name = "output_vt100" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +checksum = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9" +dependencies = [ + "winapi", +] [[package]] -name = "opaque-debug" -version = "0.3.0" +name = "parking_lot" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "paste" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5" [[package]] name = "pear" -version = "0.2.0-dev" -source = "git+https://github.com/SergioBenitez/Pear.git?rev=4b68055#4b680556063568a42fcd4328335cdfdf7608be49" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e44241c5e4c868e3eaa78b7c1848cadd6344ed4f54d029832d32b415a58702" dependencies = [ "inlinable_string", "pear_codegen", @@ -880,8 +776,9 @@ dependencies = [ [[package]] name = "pear_codegen" -version = "0.2.0-dev" -source = "git+https://github.com/SergioBenitez/Pear.git?rev=4b68055#4b680556063568a42fcd4328335cdfdf7608be49" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82a5ca643c2303ecb740d506539deba189e16f2754040a42901cd8105d0282d0" dependencies = [ "proc-macro2", "proc-macro2-diagnostics", @@ -895,31 +792,11 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "pin-project" -version = "0.4.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13fbdfd6bdee3dc9be46452f86af4a4072975899cf8592466668620bebfbcc17" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c82fb1329f632c3552cf352d14427d57a511b1cf41db93b3a7d77906a82dcc8e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "pin-project-lite" -version = "0.1.10" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e555d9e657502182ac97b539fb3dae8b79cda19e3e4f8ffb5e8de4f18df93c95" +checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" [[package]] name = "pin-utils" @@ -929,65 +806,56 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.18" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" +checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" [[package]] name = "plist" -version = "1.0.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b336d94e8e4ce29bf15bba393164629764744c567e8ad306cc1fdd0119967fd" +checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225" dependencies = [ "base64", - "chrono", "indexmap", "line-wrap", "serde", + "time", "xml-rs", ] -[[package]] -name = "polyval" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5884790f1ce3553ad55fec37b5aaac5882e0e845a2612df744d6c85c9bf046c" -dependencies = [ - "cfg-if", - "universal-hash", -] - [[package]] name = "ppv-lite86" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" - -[[package]] -name = "proc-macro-hack" -version = "0.5.18" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] -name = "proc-macro-nested" -version = "0.1.6" +name = "pretty_assertions" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" +checksum = "ec0cfe1b2403f172ba0f234e500906ee0a3e493fb81092dac23ebefe129301cc" +dependencies = [ + "ansi_term", + "ctor", + "diff", + "output_vt100", +] [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" dependencies = [ "unicode-xid", ] [[package]] name = "proc-macro2-diagnostics" -version = "0.1.0" -source = "git+https://github.com/SergioBenitez/proc-macro2-diagnostics.git?rev=13fbb43#13fbb43db72034b6f9660a9b00e338cebd8dcf44" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" dependencies = [ "proc-macro2", "quote", @@ -996,22 +864,27 @@ dependencies = [ "yansi", ] +[[package]] +name = "protobuf" +version = "2.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47c327e191621a2158159df97cdbc2e7074bb4e940275e35abf38eb3d2595754" + [[package]] name = "quote" -version = "1.0.7" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" dependencies = [ "proc-macro2", ] [[package]] name = "rand" -version = "0.7.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" dependencies = [ - "getrandom", "libc", "rand_chacha", "rand_core", @@ -1020,9 +893,9 @@ dependencies = [ [[package]] name = "rand_chacha" -version = "0.2.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", "rand_core", @@ -1030,95 +903,119 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.5.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ "getrandom", ] [[package]] name = "rand_hc" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" dependencies = [ "rand_core", ] [[package]] -name = "rayon" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf6960dc9a5b4ee8d3e4c5787b4a112a8818e0290a42ff664ad60692fdf2032" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.8.1" +name = "redox_syscall" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c4fec834fb6e6d2dd5eece3c7b432a52f0ba887cf40e595190c4107edc08bf" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "lazy_static", - "num_cpus", + "bitflags", ] [[package]] name = "ref-cast" -version = "1.0.2" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745c1787167ddae5569661d5ffb8b25ae5fedbf46717eaa92d652221cec72623" +checksum = "300f2a835d808734ee295d45007adacb9ebb29dd3ae2424acfa17930cae541da" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.2" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d21b475ab879ef0e315ad99067fa25778c3b0377f57f1b00207448dac1a3144" +checksum = "4c38e3aecd2b21cb3959637b883bb3714bc7e43f0268b9a29d3743ee3e55cdd2" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "regex" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax", +] + [[package]] name = "regex-syntax" -version = "0.6.18" +version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] [[package]] name = "rocket" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket#1369dc47a357567ec3d3d711e318248dabd4b7f7" +version = "0.5.0-rc.1" +source = "git+https://github.com/SergioBenitez/Rocket#8cae077ba1d54b92cdef3e171a730b819d5eeb8e" dependencies = [ + "async-stream", "async-trait", "atomic", "atty", "binascii", - "cookie", + "bytes", + "either", + "figment", "futures", + "indexmap", "log", "memchr", + "multer", "num_cpus", - "pear", + "parking_lot", + "pin-project-lite", + "rand", "ref-cast", "rocket_codegen", "rocket_http", + "serde", + "serde_json", "state", + "tempfile", "time", "tokio", - "toml", + "tokio-stream", + "tokio-util", "ubyte", "version_check", "yansi", @@ -1126,65 +1023,55 @@ dependencies = [ [[package]] name = "rocket_codegen" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket#1369dc47a357567ec3d3d711e318248dabd4b7f7" +version = "0.5.0-rc.1" +source = "git+https://github.com/SergioBenitez/Rocket#8cae077ba1d54b92cdef3e171a730b819d5eeb8e" dependencies = [ "devise", "glob", "indexmap", + "proc-macro2", "quote", "rocket_http", -] - -[[package]] -name = "rocket_contrib" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket#1369dc47a357567ec3d3d711e318248dabd4b7f7" -dependencies = [ - "log", - "rocket", - "serde", - "serde_json", - "tokio", + "syn", + "unicode-xid", ] [[package]] name = "rocket_http" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket#1369dc47a357567ec3d3d711e318248dabd4b7f7" +version = "0.5.0-rc.1" +source = "git+https://github.com/SergioBenitez/Rocket#8cae077ba1d54b92cdef3e171a730b819d5eeb8e" dependencies = [ "cookie", + "either", "http", "hyper", "indexmap", "log", - "mime", + "memchr", "pear", "percent-encoding", + "pin-project-lite", "ref-cast", + "serde", "smallvec", + "stable-pattern", "state", "time", "tokio", "uncased", - "unicode-xid", - "version_check", ] [[package]] -name = "rustc_version" -version = "0.2.3" +name = "rustversion" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] +checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" [[package]] name = "ryu" -version = "1.0.5" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" [[package]] name = "safemem" @@ -1201,6 +1088,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" + [[package]] name = "scopeguard" version = "1.1.0" @@ -1208,31 +1101,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] -name = "semver" -version = "0.9.0" +name = "serde" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" dependencies = [ - "semver-parser", + "serde_derive", ] -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "serde" -version = "1.0.116" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5" - [[package]] name = "serde_derive" -version = "1.0.116" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8" +checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" dependencies = [ "proc-macro2", "quote", @@ -1241,131 +1122,140 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.58" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a230ea9107ca2220eea9d46de97eddcb04cd00e92d13dda78e478dd33fa82bd4" +checksum = "d23c1ba4cf0efd44be32017709280b32d1cea5c3f1275c3b6d9e8bc54f758085" dependencies = [ - "itoa", + "itoa 1.0.1", "ryu", "serde", ] [[package]] -name = "sha1" -version = "0.6.0" +name = "serde_yaml" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +checksum = "a4a521f2940385c165a24ee286aa8599633d162077a54bdcae2a6fd5a7bfa7a0" +dependencies = [ + "indexmap", + "ryu", + "serde", + "yaml-rust", +] [[package]] -name = "sha2" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" +name = "sg-lsif" +version = "0.1.0" dependencies = [ - "block-buffer", - "cfg-if", - "cpuid-bool", - "digest", - "opaque-debug 0.3.0", + "protobuf", ] [[package]] -name = "signal-hook-registry" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035" +name = "sg-macros" +version = "0.1.0" dependencies = [ - "arc-swap", - "libc", + "pretty_assertions", + "quote", + "syn", ] [[package]] -name = "slab" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +name = "sg-syntax" +version = "0.1.0" +dependencies = [ + "anyhow", + "base64", + "cc", + "insta", + "lazy_static", + "libloading", + "paste", + "protobuf", + "rocket", + "serde", + "serde_json", + "sg-lsif", + "sg-macros", + "syntect", + "tree-sitter", + "tree-sitter-highlight", +] [[package]] -name = "smallvec" -version = "1.4.2" +name = "sharded-slab" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] [[package]] -name = "standback" -version = "0.2.10" +name = "signal-hook-registry" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33a71ea1ea5f8747d1af1979bfb7e65c3a025a70609f04ceb78425bc5adad8e6" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" dependencies = [ - "version_check", + "libc", ] [[package]] -name = "state" -version = "0.4.1" +name = "similar" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7345c971d1ef21ffdbd103a75990a15eb03604fc8b8852ca8cb418ee1a099028" +checksum = "2e24979f63a11545f5f2c60141afe249d4f19f84581ea2138065e400941d83d3" [[package]] -name = "stdweb" -version = "0.4.20" +name = "slab" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] +checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" [[package]] -name = "stdweb-derive" -version = "0.5.3" +name = "smallvec" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn", -] +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] -name = "stdweb-internal-macros" -version = "0.2.9" +name = "socket2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" dependencies = [ - "base-x", - "proc-macro2", - "quote", - "serde", - "serde_derive", - "serde_json", - "sha1", - "syn", + "libc", + "winapi", ] [[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" +name = "spin" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" +checksum = "511254be0c5bcf062b019a6c89c01a664aa359ded62f78aa72c6fc137c0590e5" [[package]] -name = "subtle" -version = "2.3.0" +name = "stable-pattern" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd" +checksum = "4564168c00635f88eaed410d5efa8131afa8d8699a612c80c455a0ba05c21045" +dependencies = [ + "memchr", +] + +[[package]] +name = "state" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cf4f5369e6d3044b5e365c9690f451516ac8f0954084622b49ea3fde2f6de5" +dependencies = [ + "loom", +] [[package]] name = "syn" -version = "1.0.42" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c51d92969d209b54a98397e1b91c8ae82d8c87a7bb87df0b29aa2ad81454228" +checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" dependencies = [ "proc-macro2", "quote", @@ -1375,7 +1265,7 @@ dependencies = [ [[package]] name = "syntect" version = "4.4.0" -source = "git+https://github.com/slimsag/syntect#579bd2328d7e0900833f3f6e7118f0b47b5e0014" +source = "git+https://github.com/slimsag/syntect#bbb71bc0cb5af9488f31a10de5ef409f5b347617" dependencies = [ "bincode", "bitflags", @@ -1395,95 +1285,131 @@ dependencies = [ [[package]] name = "syntect_server" -version = "1.0.0" +version = "1.0.1" dependencies = [ - "lazy_static", - "rayon", "rocket", - "rocket_contrib", "serde", - "serde_derive", "serde_json", + "sg-syntax", "syntect", ] [[package]] -name = "time" -version = "0.2.22" +name = "tempfile" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55b7151c9065e80917fbf285d9a5d1432f60db41d170ccafc749a136b41a93af" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "const_fn", + "cfg-if", + "fastrand", "libc", - "standback", - "stdweb", - "time-macros", - "version_check", - "winapi 0.3.9", + "redox_syscall", + "remove_dir_all", + "winapi", ] [[package]] -name = "time-macros" -version = "0.1.1" +name = "terminal_size" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" dependencies = [ - "proc-macro-hack", - "time-macros-impl", + "libc", + "winapi", ] [[package]] -name = "time-macros-impl" -version = "0.1.1" +name = "thiserror" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" +checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" dependencies = [ - "proc-macro-hack", "proc-macro2", "quote", - "standback", "syn", ] +[[package]] +name = "thread_local" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +dependencies = [ + "once_cell", +] + +[[package]] +name = "time" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "004cbc98f30fa233c61a38bc77e96a9106e65c88f2d3bef182ae952027e5753d" +dependencies = [ + "itoa 1.0.1", + "libc", + "num_threads", + "time-macros", +] + +[[package]] +name = "time-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25eb0ca3468fc0acc11828786797f6ef9aa1555e4a211a60d64cc8e4d1be47d6" + [[package]] name = "tokio" -version = "0.2.22" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" +checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838" dependencies = [ "bytes", - "fnv", - "futures-core", - "iovec", - "lazy_static", "libc", "memchr", "mio", - "mio-uds", "num_cpus", + "once_cell", "pin-project-lite", "signal-hook-registry", - "slab", "tokio-macros", - "winapi 0.3.9", + "winapi", ] [[package]] name = "tokio-macros" -version = "0.2.5" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" +checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "tokio-stream" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + [[package]] name = "tokio-util" -version = "0.3.1" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" dependencies = [ "bytes", "futures-core", @@ -1495,175 +1421,164 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.6" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" dependencies = [ "serde", ] [[package]] name = "tower-service" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.21" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0987850db3733619253fe60e17cb59b82d37c7e6c0236bb81e4d6b87c879f27" +checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" dependencies = [ "cfg-if", - "log", "pin-project-lite", + "tracing-attributes", "tracing-core", ] [[package]] -name = "tracing-core" -version = "0.1.17" +name = "tracing-attributes" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" +checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" dependencies = [ - "lazy_static", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "try-lock" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" - -[[package]] -name = "typenum" -version = "1.12.0" +name = "tracing-core" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" +dependencies = [ + "lazy_static", +] [[package]] -name = "ubyte" -version = "0.10.0" +name = "tracing-log" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8576ece1c74e91210e2ec01e016f2fb68037f8274e2e80dee775ca2fbf8a8479" +checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] [[package]] -name = "uncased" -version = "0.9.2" +name = "tracing-subscriber" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8ea1d3ee1ea37f74263095538d851d06b3ce5e0141f28681a8e630e7e7a84f0" +checksum = "5312f325fe3588e277415f5a6cca1f4ccad0f248c4cd5a4bd33032d7286abc22" dependencies = [ - "version_check", + "ansi_term", + "lazy_static", + "matchers", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", ] [[package]] -name = "unicode-xid" -version = "0.2.1" +name = "tree-sitter" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "a2355eeb5e7d836fe4cf144555855dffb04f395e5f20a15af8c53d1e1bcbd0bf" +dependencies = [ + "cc", + "regex", +] [[package]] -name = "universal-hash" -version = "0.4.0" +name = "tree-sitter-highlight" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" +checksum = "042342584c5a7a0b833d9fc4e2bdab3f9868ddc6c4b339a1e01451c6720868bc" dependencies = [ - "generic-array", - "subtle", + "regex", + "thiserror", + "tree-sitter", ] [[package]] -name = "version_check" -version = "0.9.2" +name = "try-lock" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] -name = "walkdir" -version = "2.3.1" +name = "ubyte" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" +checksum = "42756bb9e708855de2f8a98195643dff31a97f0485d90d8467b39dc24be9e8fe" dependencies = [ - "same-file", - "winapi 0.3.9", - "winapi-util", + "serde", ] [[package]] -name = "want" -version = "0.3.0" +name = "uncased" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "5baeed7327e25054889b9bd4f975f32e5f4c5d434042d59ab6cd4142c0a76ed0" dependencies = [ - "log", - "try-lock", + "serde", + "version_check", ] [[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" +name = "unicode-xid" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] -name = "wasm-bindgen" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.68" +name = "version_check" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] -name = "wasm-bindgen-macro" -version = "0.2.68" +name = "walkdir" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ - "quote", - "wasm-bindgen-macro-support", + "same-file", + "winapi", + "winapi-util", ] [[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.68" +name = "want" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", + "log", + "try-lock", ] [[package]] -name = "wasm-bindgen-shared" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" - -[[package]] -name = "winapi" -version = "0.2.8" +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "winapi" @@ -1675,12 +1590,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1693,7 +1602,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1702,27 +1611,17 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "xml-rs" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07db065a5cf61a7e4ba64f29e67db906fb1787316516c4e6e5ff0fea1efcd8a" +checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" [[package]] name = "yaml-rust" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" dependencies = [ "linked-hash-map", ] diff --git a/docker-images/syntax-highlighter/Cargo.toml b/docker-images/syntax-highlighter/Cargo.toml index e38a4c03e447..071a08a87510 100644 --- a/docker-images/syntax-highlighter/Cargo.toml +++ b/docker-images/syntax-highlighter/Cargo.toml @@ -1,16 +1,23 @@ [package] name = "syntect_server" -version = "1.0.0" -authors = ["Stephen Gutekanst "] +version = "1.0.1" +authors = [ + "TJ DeVries ", + "Stephen Gutekanst " +] edition = "2018" license = "MIT" [dependencies] syntect = { git = "https://github.com/slimsag/syntect" } -rocket = { git = "https://github.com/SergioBenitez/Rocket" } # Rocket 0.5 is not released yet: https://github.com/SergioBenitez/Rocket/issues/19#issuecomment-684122645 -rocket_contrib = { git = "https://github.com/SergioBenitez/Rocket" } # Rocket 0.5 is not released yet: https://github.com/SergioBenitez/Rocket/issues/19#issuecomment-684122645 -serde = "1.0" +rocket = { git = "https://github.com/SergioBenitez/Rocket", features = ["json"] } +serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -serde_derive = "1.0" -rayon = "1.0" -lazy_static = "1.0" +sg-syntax = { path = "./crates/sg-syntax" } + +[workspace] +members = [ + "crates/sg-lsif", + "crates/sg-macros", + "crates/sg-syntax", +] diff --git a/docker-images/syntax-highlighter/Dockerfile b/docker-images/syntax-highlighter/Dockerfile index 0f2be31d1b89..774b69b89d44 100644 --- a/docker-images/syntax-highlighter/Dockerfile +++ b/docker-images/syntax-highlighter/Dockerfile @@ -1,11 +1,12 @@ ################################### # Build syntect_server statically # ################################### -FROM rust:1.53.0-alpine3.12@sha256:115f359134b85ce7731218cee9e308dbf228eb1e03e9ddc9b92ab7ad0157a50f as ss + +FROM rust:1.58-alpine3.14@sha256:fbc0cfaa6261179ca7653cc2b20ca9c3e936f3416a911a27a28694f8fb23b8b4 as ss RUN apk add --no-cache musl-dev>=1.1.24-r10 COPY . /repo WORKDIR /repo -RUN cargo test --release +RUN cargo test --release --workspace RUN cargo rustc --release RUN ls ./target RUN cp ./target/release/syntect_server /syntect_server @@ -23,7 +24,7 @@ RUN git checkout v1.0.4 && go build -o /http-server-stabilizer . ####################### # Compile final image # ####################### -FROM sourcegraph/alpine-3.12:120059_2021-12-09_b34c7b2@sha256:9a1fde12f56fea02027cf4caeebdddfedb7b73bf8db6c16f7907a6e04a29134c +FROM sourcegraph/alpine-3.14:133078_2022-02-22_93c48931ca68@sha256:bea3854c52314db8dbf33d977117de8bcf8eeb7620da70820d5b1e9b56dc473a COPY --from=ss syntect_server / COPY --from=hss http-server-stabilizer / diff --git a/docker-images/syntax-highlighter/README.md b/docker-images/syntax-highlighter/README.md index 20e11df1531d..096fb19bcc46 100644 --- a/docker-images/syntax-highlighter/README.md +++ b/docker-images/syntax-highlighter/README.md @@ -2,40 +2,26 @@ This is an HTTP server that exposes the Rust [Syntect](https://github.com/trishume/syntect) syntax highlighting library for use by other services. Send it some code, and it'll send you syntax-highlighted code in response. -Technologies: +### Cargo Usage -- [Syntect](https://github.com/trishume/syntect) -> Syntax highlighting of code. -- [Rocket.rs](https://rocket.rs) -> Web framework. -- [Serde](https://serde.rs/) -> JSON serialization / deserialization . -- [Rayon](https://github.com/nikomatsakis/rayon) -> data parallelism for `SyntaxSet` across Rocket server threads. -- [lazy_static](https://crates.io/crates/lazy_static) -> lazily evaluated static `ThemeSet` (like a global). +```bash +cargo run --bin syntect_server +``` -## Usage +You can set the `SRC_SYNTECT_SERVER` environment var to whatever port this +connects to and test against local Sourcegraph instance. + +### Docker Usage (can be used with `sg start`) ```bash -docker run --detach --name=syntect_server -p 9238:9238 sourcegraph/syntect_server +docker run --detach --name=syntax-highlighter -p 9238:9238 sourcegraph/syntax-highlighter ``` You can then e.g. `GET` http://localhost:9238/health or http://host.docker.internal:9238/health to confirm it is working. ## API -- `POST` to `/` with `Content-Type: application/json`. The following fields are required: - - `filepath` string, e.g. `the/file.go` or `file.go` or `Dockerfile`, see "Supported file extensions" section below. - - `theme` string, e.g. `Solarized (dark)`, see "Embedded themes" section below. - - `code` string, i.e. the literal code to highlight. -- The response is a JSON object of either: - - A successful response (`data` field): - - `data` string with syntax highlighted response. The input `code` string [is properly escaped](https://github.com/sourcegraph/syntect_server/blob/ee3810f70e5701b961b7249393dbac8914c162ce/syntect/src/html.rs#L6) and as such can be directly rendered in the browser safely. - - `plaintext` boolean indicating whether a syntax could not be found for the file and instead it was rendered as plain text. - - An error response (`error` field), one of: - - `{"error": "invalid theme", "code": "invalid_theme"}` - - `{"error": "resource not found", "code": "resource_not_found"}` -- `GET` to `/health` to receive an `OK` health check response / ensure the service is alive. - -## Client - -[gosyntect](https://github.com/sourcegraph/gosyntect) is a Go package + CLI program to make requests against syntect_server. +See [API](./docs/api.md) ## Configuration @@ -43,21 +29,17 @@ By default on startup, `syntect_server` will list all features (themes + file ty ## Development -1. [Install Rust **nightly**](https://rocket.rs/guide/getting-started/#installing-rust). -2. `git clone` this repository anywhere on your filesystem. -3. Use `cargo run` to download dependencies + compile + run the server. - -## Building - -Invoke `cargo build --release` and an optimized binary will be built (e.g. to `./target/release/syntect_server`). +1. `rustup` should automatically detect what version of rust is in the `./rust-toolchain` file. +2. Make sure you've added git submodules (`git submodule update --init --recursive`) +3. Use `cargo test --workspace` to run all the tests +4. Use `cargo run --bin syntect_server` to run the server locally. +5. You can change the `SRC_SYNTECT_SERVER` option in your `sg.config.yaml` to point to whatever port you're running on (usually 8000) and test against that without building the docker image. ## Building docker image -`./build.sh` will build your current repository checkout into a final Docker image. +`./build.sh` will build your current repository checkout into a final Docker image. You **DO NOT** need to do this when you push to get it publish. But, you should do this to make sure that it is possible to build the image :smile:. -## Publishing docker image - -This will happen automatically via CI. You don't need to do anything after merging to main. +**AGAIN NOTE**: The docker image will be published automatically via CI. ## Updating Sourcegraph @@ -68,12 +50,10 @@ Once published, the image version will need to be updated in the following locat Additionally, it's worth doing a [search](https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/sourcegraph/sourcegraph%24+sourcegraph/syntect_server:&patternType=literal) for other uses in case this list is stale. -## Code hygiene - -- Use `cargo fmt` or an editor extension to format code. - ## Adding themes +TODO: Maybe we can just remove themes entirely. I think they are u + - Copy a `.tmTheme` file anywhere under `./syntect/testdata` (make a new dir if needed) [in our fork](https://github.com/slimsag/syntect). - `cd syntect && make assets` - In this repo, `cargo update -p syntect`. @@ -81,6 +61,8 @@ Additionally, it's worth doing a [search](https://sourcegraph.com/search?q=repo: ## Adding languages: +TODO: Update these instructions once we move to sourcegraph/syntect. + #### 1) Find an open-source `.tmLanguage` or `.sublime-syntax` file and send a PR to our package registry https://github.com/slimsag/Packages is the package registry we use which holds all of the syntax definitions we use in syntect_server and Sourcegraph. Send a PR there by following [these steps](https://github.com/slimsag/Packages/blob/master/README.md#adding-a-new-language) @@ -100,177 +82,6 @@ Run the following in this directory. $ cargo update -p syntect ``` -## Embedded themes: - -- `InspiredGitHub` -- `Monokai` -- `Solarized (dark)` -- `Solarized (light)` -- `Sourcegraph` -- `Sourcegraph (light)` -- `TypeScript` -- `TypeScriptReact` -- `Visual Studio` -- `Visual Studio Dark` -- `base16-eighties.dark` -- `base16-mocha.dark` -- `base16-ocean.dark` -- `base16-ocean.light` - -## Supported file extensions: - -- Plain Text (`txt`) -- ASP (`asa`) -- HTML (ASP) (`asp`) -- ASP vb.NET (`vb`) -- HTML (ASP.net) (`aspx`, `ascx`, `master`) -- ActionScript (`as`) -- Apex (`apex`, `cls`, `trigger`) -- AppleScript (`applescript`, `script editor`) -- Batch File (`bat`, `cmd`) -- NAnt Build File (`build`) -- C# (`cs`, `csx`) -- C++ (`cpp`, `cc`, `cp`, `cxx`, `c++`, `C`, `h`, `hh`, `hpp`, `hxx`, `h++`, `inl`, `ipp`) -- C (`c`, `h`) -- CMake Cache (`CMakeCache.txt`) -- CMake Listfile (`CMakeLists.txt`, `cmake`) -- ACUCOBOL (``) -- COBOL (`cbl`, `cpy`, `cob`, `dds`, `ss`, `wks`, `pco`) -- OpenCOBOL (``) -- jcl (`jcl`) -- CSS (`css`, `css.erb`, `css.liquid`) -- Cap’n Proto (`capnp`) -- Cg (`cg`) -- Clojure (`clj`, `cljc`, `cljs`, `cljx`, `edn`) -- Coq (`v`) -- Crontab (`crontab`) -- CUDA C++ (`cu`, `cuh`) -- D (`d`, `di`) -- DMD Output (``) -- Dart Doc Comments (``) -- Dart (`dart`) -- Diff (`diff`, `patch`) -- Dockerfile (`Dockerfile`) -- DM (`dm`, `dme`) -- Elixir (EEx) (`ex.eex`, `exs.eex`) -- Elixir (`ex`, `exs`) -- HTML (EEx) (`html.eex`, `html.leex`) -- Regular Expressions (Elixir) (`ex.re`) -- SQL (Elixir) (`ex.sql`) -- Elm (`elm`) -- Erlang (`erl`, `hrl`, `Emakefile`, `emakefile`, `escript`) -- HTML (Erlang) (`yaws`) -- Solidity (`sol`) -- Vyper (`vy`) -- F Sharp (`fs`) -- friendly interactive shell (fish) (`fish`) -- Forth (`frt`, `fs`) -- ESSL (`essl`, `f.essl`, `v.essl`, `_v.essl`, `_f.essl`, `_vs.essl`, `_fs.essl`) -- GLSL (`vs`, `fs`, `gs`, `vsh`, `fsh`, `gsh`, `vshader`, `fshader`, `gshader`, `vert`, `frag`, `geom`, `tesc`, `tese`, `comp`, `glsl`) -- Git Attributes (`attributes`, `gitattributes`, `.gitattributes`) -- Git Commit (`COMMIT_EDITMSG`, `MERGE_MSG`, `TAG_EDITMSG`) -- Git Common (``) -- Git Config (`gitconfig`, `.gitconfig`, `.gitmodules`) -- Git Ignore (`exclude`, `gitignore`, `.gitignore`) -- Git Link (`.git`) -- Git Log (`gitlog`) -- Git Mailmap (`.mailmap`, `mailmap`) -- Git Rebase Todo (`git-rebase-todo`) -- Go (`go`) -- GraphQL (`graphql`, `graphqls`, `gql`, `graphcool`) -- Graphviz (DOT) (`dot`, `DOT`, `gv`) -- Groovy (`groovy`, `gvy`, `gradle`, `Jenkinsfile`) -- HLSL (`fx`, `fxh`, `hlsl`, `hlsli`, `usf`) -- HTML (`html`, `htm`, `shtml`, `xhtml`) -- Haskell (`hs`) -- Literate Haskell (`lhs`) -- INI (`cfg`, `conf`, `ini`, `lng`, `url`, `.buckconfig`, `.flowconfig`, `.hgrc`) -- REG (`reg`) -- JSON (`json`, `sublime-settings`, `sublime-menu`, `sublime-keymap`, `sublime-mousemap`, `sublime-theme`, `sublime-build`, `sublime-project`, `sublime-completions`, `sublime-commands`, `sublime-macro`, `sublime-color-scheme`, `ipynb`, `Pipfile.lock`) -- Java Server Page (JSP) (`jsp`) -- Java (`java`, `bsh`) -- Javadoc (``) -- Java Properties (`properties`) -- JS Custom - Default (`js`, `htc`) -- JS Custom - React (`js`, `jsx`) -- Regular Expressions (Javascript) (``) -- JS Custom (Embedded) (``) -- Julia (`jl`) -- Kotlin (`kt`, `kts`) -- LESS (`less`) -- BibTeX (`bib`) -- LaTeX Log (``) -- LaTeX (`tex`, `ltx`) -- TeX (`sty`, `cls`) -- Lisp (`lisp`, `cl`, `clisp`, `l`, `mud`, `el`, `scm`, `ss`, `lsp`, `fasl`) -- Lua (`lua`) -- MSBuild (`proj`, `targets`, `msbuild`, `csproj`, `vbproj`, `fsproj`, `vcxproj`) -- Make Output (``) -- Makefile (`make`, `GNUmakefile`, `makefile`, `Makefile`, `makefile.am`, `Makefile.am`, `makefile.in`, `Makefile.in`, `OCamlMakefile`, `mak`, `mk`) -- Man (`man`) -- Markdown (`md`, `mdown`, `markdown`, `markdn`) -- MultiMarkdown (``) -- MATLAB (`matlab`) -- Maven POM (`pom.xml`) -- Mediawiki (`mediawiki`, `wikipedia`, `wiki`) -- Move (`move`) -- Ninja (`ninja`) -- Nix (`nix`) -- OCaml (`ml`, `mli`) -- OCamllex (`mll`) -- OCamlyacc (`mly`) -- camlp4 (``) -- Objective-C++ (`mm`, `M`, `h`) -- Objective-C (`m`, `h`) -- PHP Source (``) -- PHP (`php`, `php3`, `php4`, `php5`, `php7`, `phps`, `phpt`, `phtml`) -- Regular Expressions (PHP) (``) -- Pascal (`pas`, `p`, `dpr`) -- Perl (`pl`, `pc`, `pm`, `pmc`, `pod`, `t`) -- Property List (XML) (``) -- Postscript (`ps`, `eps`) -- PowerShell (`ps1`, `psm1`, `psd1`) -- Protocol Buffer (`proto`) -- Puppet (`pp`, `epp`) -- Python (`py`, `py3`, `pyw`, `pyi`, `pyx`, `pyx.in`, `pxd`, `pxd.in`, `pxi`, `pxi.in`, `rpy`, `cpy`, `SConstruct`, `Sconstruct`, `sconstruct`, `SConscript`, `pyst`, `pyst-include`, `gyp`, `gypi`, `Snakefile`, `vpy`, `wscript`, `bazel`, `bzl`) -- Regular Expressions (Python) (``) -- R Console (``) -- R (`R`, `r`, `Rprofile`) -- Rd (R Documentation) (`rd`) -- RPM Spec (`spec`) -- HTML (Rails) (`rails`, `rhtml`, `erb`, `html.erb`) -- JavaScript (Rails) (`js.erb`) -- Ruby Haml (`haml`) -- Ruby on Rails (`rxml`, `builder`) -- SQL (Rails) (`erbsql`, `sql.erb`) -- Regular Expression (`re`) -- reStructuredText (`rst`, `rest`) -- Ruby (`rb`, `Appfile`, `Appraisals`, `Berksfile`, `Brewfile`, `capfile`, `cgi`, `Cheffile`, `config.ru`, `Deliverfile`, `Fastfile`, `fcgi`, `Gemfile`, `gemspec`, `Guardfile`, `irbrc`, `jbuilder`, `Podfile`, `podspec`, `prawn`, `rabl`, `rake`, `Rakefile`, `Rantfile`, `rbx`, `rjs`, `ruby.rail`, `Scanfile`, `simplecov`, `Snapfile`, `thor`, `Thorfile`, `Vagrantfile`) -- Cargo Build Results (``) -- Rust Enhanced (`rs`) -- Sass (`sass`, `scss`) -- SQL (`sql`, `ddl`, `dml`) -- Scala (`scala`, `sbt`, `sc`) -- Bourne Again Shell (bash) (`sh`, `bash`, `zsh`, `ash`, `.bash_aliases`, `.bash_completions`, `.bash_functions`, `.bash_login`, `.bash_logout`, `.bash_profile`, `.bash_variables`, `.bashrc`, `.profile`, `.textmate_init`, `.zlogin`, `.zlogout`, `.zprofile `, `.zshenv`, `.zshrc`, `PKGBUILD`, `.ebuild`, `.eclass`) -- Shell-Unix-Generic (``) -- commands-builtin-shell-bash (``) -- Smalltalk (`st`) -- Smarty (`tpl`) -- Starlark (`build_defs`, `BUILD.in`, `BUILD`, `WORKSPACE`, `bzl`, `sky`, `star`, `BUILD.bazel`, `WORKSPACE`, `WORKSPACE.bazel`) -- Stylus (`styl`, `stylus`) -- Swift (`swift`) -- HTML (Tcl) (`adp`) -- Tcl (`tcl`) -- TOML (`toml`) -- Terraform (`tf`, `tfvars`, `hcl`) -- Textile (`textile`) -- Thrift (`thrift`, `frugal`) -- TypeScript (`ts`) -- TypeScriptReact (`tsx`) -- vhdl.tmLanguage (``) -- verilog.tmLanguage (``) -- VimL (`vim`, `.vimrc`, `.gvimrc`) -- Vue Component (`vue`) -- XML (`xml`, `xsd`, `xslt`, `tld`, `dtml`, `rng`, `rss`, `opml`, `svg`) -- YAML (`yaml`, `yml`, `sublime-syntax`) -- Zig (`zig`) +## Supported languages: + +Run: `cargo run --bin syntect_server` to see supported languages and themes. diff --git a/docker-images/syntax-highlighter/build.sh b/docker-images/syntax-highlighter/build.sh index 2eae3e86fdaf..5f7df90636e0 100755 --- a/docker-images/syntax-highlighter/build.sh +++ b/docker-images/syntax-highlighter/build.sh @@ -3,4 +3,7 @@ set -ex cd "$(dirname "${BASH_SOURCE[0]}")" +# Make sure we have all tree-sitter modules cloned. +git submodule update --init --recursive + docker build -t "${IMAGE:-sourcegraph/syntax-highlighter}" . diff --git a/docker-images/syntax-highlighter/crates/sg-lsif/Cargo.toml b/docker-images/syntax-highlighter/crates/sg-lsif/Cargo.toml new file mode 100644 index 000000000000..78d9e15fe926 --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-lsif/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "sg-lsif" +version = "0.1.0" +edition = "2021" + +[lib] +path = "src/lsif.rs" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +protobuf = "2.25.2" diff --git a/docker-images/syntax-highlighter/crates/sg-lsif/src/lsif.rs b/docker-images/syntax-highlighter/crates/sg-lsif/src/lsif.rs new file mode 100644 index 000000000000..75eb5b360f90 --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-lsif/src/lsif.rs @@ -0,0 +1,4111 @@ +// This file is generated by rust-protobuf 2.27.1. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_imports)] +#![allow(unused_results)] +//! Generated file from `lib/codeintel/lsiftyped/lsif.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_27_1; + +#[derive(PartialEq,Clone,Default)] +pub struct Index { + // message fields + pub metadata: ::protobuf::SingularPtrField, + pub documents: ::protobuf::RepeatedField, + pub external_symbols: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Index { + fn default() -> &'a Index { + ::default_instance() + } +} + +impl Index { + pub fn new() -> Index { + ::std::default::Default::default() + } + + // .lib.codeintel.lsiftyped.Metadata metadata = 1; + + + pub fn get_metadata(&self) -> &Metadata { + self.metadata.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_metadata(&mut self) { + self.metadata.clear(); + } + + pub fn has_metadata(&self) -> bool { + self.metadata.is_some() + } + + // Param is passed by value, moved + pub fn set_metadata(&mut self, v: Metadata) { + self.metadata = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_metadata(&mut self) -> &mut Metadata { + if self.metadata.is_none() { + self.metadata.set_default(); + } + self.metadata.as_mut().unwrap() + } + + // Take field + pub fn take_metadata(&mut self) -> Metadata { + self.metadata.take().unwrap_or_else(|| Metadata::new()) + } + + // repeated .lib.codeintel.lsiftyped.Document documents = 2; + + + pub fn get_documents(&self) -> &[Document] { + &self.documents + } + pub fn clear_documents(&mut self) { + self.documents.clear(); + } + + // Param is passed by value, moved + pub fn set_documents(&mut self, v: ::protobuf::RepeatedField) { + self.documents = v; + } + + // Mutable pointer to the field. + pub fn mut_documents(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.documents + } + + // Take field + pub fn take_documents(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.documents, ::protobuf::RepeatedField::new()) + } + + // repeated .lib.codeintel.lsiftyped.SymbolInformation external_symbols = 3; + + + pub fn get_external_symbols(&self) -> &[SymbolInformation] { + &self.external_symbols + } + pub fn clear_external_symbols(&mut self) { + self.external_symbols.clear(); + } + + // Param is passed by value, moved + pub fn set_external_symbols(&mut self, v: ::protobuf::RepeatedField) { + self.external_symbols = v; + } + + // Mutable pointer to the field. + pub fn mut_external_symbols(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.external_symbols + } + + // Take field + pub fn take_external_symbols(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.external_symbols, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for Index { + fn is_initialized(&self) -> bool { + for v in &self.metadata { + if !v.is_initialized() { + return false; + } + }; + for v in &self.documents { + if !v.is_initialized() { + return false; + } + }; + for v in &self.external_symbols { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.metadata)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.documents)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.external_symbols)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.metadata.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.documents { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.external_symbols { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.metadata.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.documents { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.external_symbols { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Index { + Index::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "metadata", + |m: &Index| { &m.metadata }, + |m: &mut Index| { &mut m.metadata }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "documents", + |m: &Index| { &m.documents }, + |m: &mut Index| { &mut m.documents }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "external_symbols", + |m: &Index| { &m.external_symbols }, + |m: &mut Index| { &mut m.external_symbols }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Index", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Index { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Index::new) + } +} + +impl ::protobuf::Clear for Index { + fn clear(&mut self) { + self.metadata.clear(); + self.documents.clear(); + self.external_symbols.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Index { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Index { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Metadata { + // message fields + pub version: ProtocolVersion, + pub tool_info: ::protobuf::SingularPtrField, + pub project_root: ::std::string::String, + pub text_document_encoding: TextEncoding, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Metadata { + fn default() -> &'a Metadata { + ::default_instance() + } +} + +impl Metadata { + pub fn new() -> Metadata { + ::std::default::Default::default() + } + + // .lib.codeintel.lsiftyped.ProtocolVersion version = 1; + + + pub fn get_version(&self) -> ProtocolVersion { + self.version + } + pub fn clear_version(&mut self) { + self.version = ProtocolVersion::UnspecifiedProtocolVersion; + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: ProtocolVersion) { + self.version = v; + } + + // .lib.codeintel.lsiftyped.ToolInfo tool_info = 2; + + + pub fn get_tool_info(&self) -> &ToolInfo { + self.tool_info.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_tool_info(&mut self) { + self.tool_info.clear(); + } + + pub fn has_tool_info(&self) -> bool { + self.tool_info.is_some() + } + + // Param is passed by value, moved + pub fn set_tool_info(&mut self, v: ToolInfo) { + self.tool_info = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_tool_info(&mut self) -> &mut ToolInfo { + if self.tool_info.is_none() { + self.tool_info.set_default(); + } + self.tool_info.as_mut().unwrap() + } + + // Take field + pub fn take_tool_info(&mut self) -> ToolInfo { + self.tool_info.take().unwrap_or_else(|| ToolInfo::new()) + } + + // string project_root = 3; + + + pub fn get_project_root(&self) -> &str { + &self.project_root + } + pub fn clear_project_root(&mut self) { + self.project_root.clear(); + } + + // Param is passed by value, moved + pub fn set_project_root(&mut self, v: ::std::string::String) { + self.project_root = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_project_root(&mut self) -> &mut ::std::string::String { + &mut self.project_root + } + + // Take field + pub fn take_project_root(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.project_root, ::std::string::String::new()) + } + + // .lib.codeintel.lsiftyped.TextEncoding text_document_encoding = 4; + + + pub fn get_text_document_encoding(&self) -> TextEncoding { + self.text_document_encoding + } + pub fn clear_text_document_encoding(&mut self) { + self.text_document_encoding = TextEncoding::UnspecifiedTextEncoding; + } + + // Param is passed by value, moved + pub fn set_text_document_encoding(&mut self, v: TextEncoding) { + self.text_document_encoding = v; + } +} + +impl ::protobuf::Message for Metadata { + fn is_initialized(&self) -> bool { + for v in &self.tool_info { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.version, 1, &mut self.unknown_fields)? + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.tool_info)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.project_root)?; + }, + 4 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.text_document_encoding, 4, &mut self.unknown_fields)? + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.version != ProtocolVersion::UnspecifiedProtocolVersion { + my_size += ::protobuf::rt::enum_size(1, self.version); + } + if let Some(ref v) = self.tool_info.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.project_root.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.project_root); + } + if self.text_document_encoding != TextEncoding::UnspecifiedTextEncoding { + my_size += ::protobuf::rt::enum_size(4, self.text_document_encoding); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if self.version != ProtocolVersion::UnspecifiedProtocolVersion { + os.write_enum(1, ::protobuf::ProtobufEnum::value(&self.version))?; + } + if let Some(ref v) = self.tool_info.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.project_root.is_empty() { + os.write_string(3, &self.project_root)?; + } + if self.text_document_encoding != TextEncoding::UnspecifiedTextEncoding { + os.write_enum(4, ::protobuf::ProtobufEnum::value(&self.text_document_encoding))?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Metadata { + Metadata::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "version", + |m: &Metadata| { &m.version }, + |m: &mut Metadata| { &mut m.version }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "tool_info", + |m: &Metadata| { &m.tool_info }, + |m: &mut Metadata| { &mut m.tool_info }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "project_root", + |m: &Metadata| { &m.project_root }, + |m: &mut Metadata| { &mut m.project_root }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "text_document_encoding", + |m: &Metadata| { &m.text_document_encoding }, + |m: &mut Metadata| { &mut m.text_document_encoding }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Metadata", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Metadata { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Metadata::new) + } +} + +impl ::protobuf::Clear for Metadata { + fn clear(&mut self) { + self.version = ProtocolVersion::UnspecifiedProtocolVersion; + self.tool_info.clear(); + self.project_root.clear(); + self.text_document_encoding = TextEncoding::UnspecifiedTextEncoding; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Metadata { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Metadata { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ToolInfo { + // message fields + pub name: ::std::string::String, + pub version: ::std::string::String, + pub arguments: ::protobuf::RepeatedField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ToolInfo { + fn default() -> &'a ToolInfo { + ::default_instance() + } +} + +impl ToolInfo { + pub fn new() -> ToolInfo { + ::std::default::Default::default() + } + + // string name = 1; + + + pub fn get_name(&self) -> &str { + &self.name + } + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + // string version = 2; + + + pub fn get_version(&self) -> &str { + &self.version + } + pub fn clear_version(&mut self) { + self.version.clear(); + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: ::std::string::String) { + self.version = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_version(&mut self) -> &mut ::std::string::String { + &mut self.version + } + + // Take field + pub fn take_version(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.version, ::std::string::String::new()) + } + + // repeated string arguments = 3; + + + pub fn get_arguments(&self) -> &[::std::string::String] { + &self.arguments + } + pub fn clear_arguments(&mut self) { + self.arguments.clear(); + } + + // Param is passed by value, moved + pub fn set_arguments(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.arguments = v; + } + + // Mutable pointer to the field. + pub fn mut_arguments(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.arguments + } + + // Take field + pub fn take_arguments(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.arguments, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for ToolInfo { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.version)?; + }, + 3 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.arguments)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.name); + } + if !self.version.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.version); + } + for value in &self.arguments { + my_size += ::protobuf::rt::string_size(3, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.name.is_empty() { + os.write_string(1, &self.name)?; + } + if !self.version.is_empty() { + os.write_string(2, &self.version)?; + } + for v in &self.arguments { + os.write_string(3, &v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ToolInfo { + ToolInfo::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + |m: &ToolInfo| { &m.name }, + |m: &mut ToolInfo| { &mut m.name }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "version", + |m: &ToolInfo| { &m.version }, + |m: &mut ToolInfo| { &mut m.version }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "arguments", + |m: &ToolInfo| { &m.arguments }, + |m: &mut ToolInfo| { &mut m.arguments }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ToolInfo", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ToolInfo { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ToolInfo::new) + } +} + +impl ::protobuf::Clear for ToolInfo { + fn clear(&mut self) { + self.name.clear(); + self.version.clear(); + self.arguments.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ToolInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ToolInfo { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Document { + // message fields + pub relative_path: ::std::string::String, + pub occurrences: ::protobuf::RepeatedField, + pub symbols: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Document { + fn default() -> &'a Document { + ::default_instance() + } +} + +impl Document { + pub fn new() -> Document { + ::std::default::Default::default() + } + + // string relative_path = 1; + + + pub fn get_relative_path(&self) -> &str { + &self.relative_path + } + pub fn clear_relative_path(&mut self) { + self.relative_path.clear(); + } + + // Param is passed by value, moved + pub fn set_relative_path(&mut self, v: ::std::string::String) { + self.relative_path = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_relative_path(&mut self) -> &mut ::std::string::String { + &mut self.relative_path + } + + // Take field + pub fn take_relative_path(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.relative_path, ::std::string::String::new()) + } + + // repeated .lib.codeintel.lsiftyped.Occurrence occurrences = 2; + + + pub fn get_occurrences(&self) -> &[Occurrence] { + &self.occurrences + } + pub fn clear_occurrences(&mut self) { + self.occurrences.clear(); + } + + // Param is passed by value, moved + pub fn set_occurrences(&mut self, v: ::protobuf::RepeatedField) { + self.occurrences = v; + } + + // Mutable pointer to the field. + pub fn mut_occurrences(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.occurrences + } + + // Take field + pub fn take_occurrences(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.occurrences, ::protobuf::RepeatedField::new()) + } + + // repeated .lib.codeintel.lsiftyped.SymbolInformation symbols = 3; + + + pub fn get_symbols(&self) -> &[SymbolInformation] { + &self.symbols + } + pub fn clear_symbols(&mut self) { + self.symbols.clear(); + } + + // Param is passed by value, moved + pub fn set_symbols(&mut self, v: ::protobuf::RepeatedField) { + self.symbols = v; + } + + // Mutable pointer to the field. + pub fn mut_symbols(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.symbols + } + + // Take field + pub fn take_symbols(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.symbols, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for Document { + fn is_initialized(&self) -> bool { + for v in &self.occurrences { + if !v.is_initialized() { + return false; + } + }; + for v in &self.symbols { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.relative_path)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.occurrences)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.symbols)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.relative_path.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.relative_path); + } + for value in &self.occurrences { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.symbols { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.relative_path.is_empty() { + os.write_string(1, &self.relative_path)?; + } + for v in &self.occurrences { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.symbols { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Document { + Document::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "relative_path", + |m: &Document| { &m.relative_path }, + |m: &mut Document| { &mut m.relative_path }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "occurrences", + |m: &Document| { &m.occurrences }, + |m: &mut Document| { &mut m.occurrences }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "symbols", + |m: &Document| { &m.symbols }, + |m: &mut Document| { &mut m.symbols }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Document", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Document { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Document::new) + } +} + +impl ::protobuf::Clear for Document { + fn clear(&mut self) { + self.relative_path.clear(); + self.occurrences.clear(); + self.symbols.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Document { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Document { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Symbol { + // message fields + pub scheme: ::std::string::String, + pub package: ::protobuf::SingularPtrField, + pub descriptors: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Symbol { + fn default() -> &'a Symbol { + ::default_instance() + } +} + +impl Symbol { + pub fn new() -> Symbol { + ::std::default::Default::default() + } + + // string scheme = 1; + + + pub fn get_scheme(&self) -> &str { + &self.scheme + } + pub fn clear_scheme(&mut self) { + self.scheme.clear(); + } + + // Param is passed by value, moved + pub fn set_scheme(&mut self, v: ::std::string::String) { + self.scheme = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_scheme(&mut self) -> &mut ::std::string::String { + &mut self.scheme + } + + // Take field + pub fn take_scheme(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.scheme, ::std::string::String::new()) + } + + // .lib.codeintel.lsiftyped.Package package = 2; + + + pub fn get_package(&self) -> &Package { + self.package.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_package(&mut self) { + self.package.clear(); + } + + pub fn has_package(&self) -> bool { + self.package.is_some() + } + + // Param is passed by value, moved + pub fn set_package(&mut self, v: Package) { + self.package = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_package(&mut self) -> &mut Package { + if self.package.is_none() { + self.package.set_default(); + } + self.package.as_mut().unwrap() + } + + // Take field + pub fn take_package(&mut self) -> Package { + self.package.take().unwrap_or_else(|| Package::new()) + } + + // repeated .lib.codeintel.lsiftyped.Descriptor descriptors = 3; + + + pub fn get_descriptors(&self) -> &[Descriptor] { + &self.descriptors + } + pub fn clear_descriptors(&mut self) { + self.descriptors.clear(); + } + + // Param is passed by value, moved + pub fn set_descriptors(&mut self, v: ::protobuf::RepeatedField) { + self.descriptors = v; + } + + // Mutable pointer to the field. + pub fn mut_descriptors(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.descriptors + } + + // Take field + pub fn take_descriptors(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.descriptors, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for Symbol { + fn is_initialized(&self) -> bool { + for v in &self.package { + if !v.is_initialized() { + return false; + } + }; + for v in &self.descriptors { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.scheme)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.package)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.descriptors)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.scheme.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.scheme); + } + if let Some(ref v) = self.package.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.descriptors { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.scheme.is_empty() { + os.write_string(1, &self.scheme)?; + } + if let Some(ref v) = self.package.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.descriptors { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Symbol { + Symbol::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "scheme", + |m: &Symbol| { &m.scheme }, + |m: &mut Symbol| { &mut m.scheme }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "package", + |m: &Symbol| { &m.package }, + |m: &mut Symbol| { &mut m.package }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "descriptors", + |m: &Symbol| { &m.descriptors }, + |m: &mut Symbol| { &mut m.descriptors }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Symbol", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Symbol { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Symbol::new) + } +} + +impl ::protobuf::Clear for Symbol { + fn clear(&mut self) { + self.scheme.clear(); + self.package.clear(); + self.descriptors.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Symbol { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Symbol { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Package { + // message fields + pub manager: ::std::string::String, + pub name: ::std::string::String, + pub version: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Package { + fn default() -> &'a Package { + ::default_instance() + } +} + +impl Package { + pub fn new() -> Package { + ::std::default::Default::default() + } + + // string manager = 1; + + + pub fn get_manager(&self) -> &str { + &self.manager + } + pub fn clear_manager(&mut self) { + self.manager.clear(); + } + + // Param is passed by value, moved + pub fn set_manager(&mut self, v: ::std::string::String) { + self.manager = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_manager(&mut self) -> &mut ::std::string::String { + &mut self.manager + } + + // Take field + pub fn take_manager(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.manager, ::std::string::String::new()) + } + + // string name = 2; + + + pub fn get_name(&self) -> &str { + &self.name + } + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + // string version = 3; + + + pub fn get_version(&self) -> &str { + &self.version + } + pub fn clear_version(&mut self) { + self.version.clear(); + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: ::std::string::String) { + self.version = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_version(&mut self) -> &mut ::std::string::String { + &mut self.version + } + + // Take field + pub fn take_version(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.version, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for Package { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.manager)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.version)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.manager.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.manager); + } + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.name); + } + if !self.version.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.version); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.manager.is_empty() { + os.write_string(1, &self.manager)?; + } + if !self.name.is_empty() { + os.write_string(2, &self.name)?; + } + if !self.version.is_empty() { + os.write_string(3, &self.version)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Package { + Package::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "manager", + |m: &Package| { &m.manager }, + |m: &mut Package| { &mut m.manager }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + |m: &Package| { &m.name }, + |m: &mut Package| { &mut m.name }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "version", + |m: &Package| { &m.version }, + |m: &mut Package| { &mut m.version }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Package", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Package { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Package::new) + } +} + +impl ::protobuf::Clear for Package { + fn clear(&mut self) { + self.manager.clear(); + self.name.clear(); + self.version.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Package { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Package { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Descriptor { + // message fields + pub name: ::std::string::String, + pub disambiguator: ::std::string::String, + pub suffix: Descriptor_Suffix, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Descriptor { + fn default() -> &'a Descriptor { + ::default_instance() + } +} + +impl Descriptor { + pub fn new() -> Descriptor { + ::std::default::Default::default() + } + + // string name = 1; + + + pub fn get_name(&self) -> &str { + &self.name + } + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + // string disambiguator = 2; + + + pub fn get_disambiguator(&self) -> &str { + &self.disambiguator + } + pub fn clear_disambiguator(&mut self) { + self.disambiguator.clear(); + } + + // Param is passed by value, moved + pub fn set_disambiguator(&mut self, v: ::std::string::String) { + self.disambiguator = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_disambiguator(&mut self) -> &mut ::std::string::String { + &mut self.disambiguator + } + + // Take field + pub fn take_disambiguator(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.disambiguator, ::std::string::String::new()) + } + + // .lib.codeintel.lsiftyped.Descriptor.Suffix suffix = 3; + + + pub fn get_suffix(&self) -> Descriptor_Suffix { + self.suffix + } + pub fn clear_suffix(&mut self) { + self.suffix = Descriptor_Suffix::UnspecifiedSuffix; + } + + // Param is passed by value, moved + pub fn set_suffix(&mut self, v: Descriptor_Suffix) { + self.suffix = v; + } +} + +impl ::protobuf::Message for Descriptor { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.disambiguator)?; + }, + 3 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.suffix, 3, &mut self.unknown_fields)? + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.name); + } + if !self.disambiguator.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.disambiguator); + } + if self.suffix != Descriptor_Suffix::UnspecifiedSuffix { + my_size += ::protobuf::rt::enum_size(3, self.suffix); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.name.is_empty() { + os.write_string(1, &self.name)?; + } + if !self.disambiguator.is_empty() { + os.write_string(2, &self.disambiguator)?; + } + if self.suffix != Descriptor_Suffix::UnspecifiedSuffix { + os.write_enum(3, ::protobuf::ProtobufEnum::value(&self.suffix))?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Descriptor { + Descriptor::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + |m: &Descriptor| { &m.name }, + |m: &mut Descriptor| { &mut m.name }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "disambiguator", + |m: &Descriptor| { &m.disambiguator }, + |m: &mut Descriptor| { &mut m.disambiguator }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "suffix", + |m: &Descriptor| { &m.suffix }, + |m: &mut Descriptor| { &mut m.suffix }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Descriptor", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Descriptor { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Descriptor::new) + } +} + +impl ::protobuf::Clear for Descriptor { + fn clear(&mut self) { + self.name.clear(); + self.disambiguator.clear(); + self.suffix = Descriptor_Suffix::UnspecifiedSuffix; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Descriptor { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Descriptor { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum Descriptor_Suffix { + UnspecifiedSuffix = 0, + Package = 1, + Type = 2, + Term = 3, + Method = 4, + TypeParameter = 5, + Parameter = 6, + Meta = 7, + Local = 8, +} + +impl ::protobuf::ProtobufEnum for Descriptor_Suffix { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(Descriptor_Suffix::UnspecifiedSuffix), + 1 => ::std::option::Option::Some(Descriptor_Suffix::Package), + 2 => ::std::option::Option::Some(Descriptor_Suffix::Type), + 3 => ::std::option::Option::Some(Descriptor_Suffix::Term), + 4 => ::std::option::Option::Some(Descriptor_Suffix::Method), + 5 => ::std::option::Option::Some(Descriptor_Suffix::TypeParameter), + 6 => ::std::option::Option::Some(Descriptor_Suffix::Parameter), + 7 => ::std::option::Option::Some(Descriptor_Suffix::Meta), + 8 => ::std::option::Option::Some(Descriptor_Suffix::Local), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [Descriptor_Suffix] = &[ + Descriptor_Suffix::UnspecifiedSuffix, + Descriptor_Suffix::Package, + Descriptor_Suffix::Type, + Descriptor_Suffix::Term, + Descriptor_Suffix::Method, + Descriptor_Suffix::TypeParameter, + Descriptor_Suffix::Parameter, + Descriptor_Suffix::Meta, + Descriptor_Suffix::Local, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new_pb_name::("Descriptor.Suffix", file_descriptor_proto()) + }) + } +} + +impl ::std::marker::Copy for Descriptor_Suffix { +} + +impl ::std::default::Default for Descriptor_Suffix { + fn default() -> Self { + Descriptor_Suffix::UnspecifiedSuffix + } +} + +impl ::protobuf::reflect::ProtobufValue for Descriptor_Suffix { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct SymbolInformation { + // message fields + pub symbol: ::std::string::String, + pub documentation: ::protobuf::RepeatedField<::std::string::String>, + pub relationships: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a SymbolInformation { + fn default() -> &'a SymbolInformation { + ::default_instance() + } +} + +impl SymbolInformation { + pub fn new() -> SymbolInformation { + ::std::default::Default::default() + } + + // string symbol = 1; + + + pub fn get_symbol(&self) -> &str { + &self.symbol + } + pub fn clear_symbol(&mut self) { + self.symbol.clear(); + } + + // Param is passed by value, moved + pub fn set_symbol(&mut self, v: ::std::string::String) { + self.symbol = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_symbol(&mut self) -> &mut ::std::string::String { + &mut self.symbol + } + + // Take field + pub fn take_symbol(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.symbol, ::std::string::String::new()) + } + + // repeated string documentation = 3; + + + pub fn get_documentation(&self) -> &[::std::string::String] { + &self.documentation + } + pub fn clear_documentation(&mut self) { + self.documentation.clear(); + } + + // Param is passed by value, moved + pub fn set_documentation(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.documentation = v; + } + + // Mutable pointer to the field. + pub fn mut_documentation(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.documentation + } + + // Take field + pub fn take_documentation(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.documentation, ::protobuf::RepeatedField::new()) + } + + // repeated .lib.codeintel.lsiftyped.Relationship relationships = 4; + + + pub fn get_relationships(&self) -> &[Relationship] { + &self.relationships + } + pub fn clear_relationships(&mut self) { + self.relationships.clear(); + } + + // Param is passed by value, moved + pub fn set_relationships(&mut self, v: ::protobuf::RepeatedField) { + self.relationships = v; + } + + // Mutable pointer to the field. + pub fn mut_relationships(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.relationships + } + + // Take field + pub fn take_relationships(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.relationships, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for SymbolInformation { + fn is_initialized(&self) -> bool { + for v in &self.relationships { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.symbol)?; + }, + 3 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.documentation)?; + }, + 4 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.relationships)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.symbol.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.symbol); + } + for value in &self.documentation { + my_size += ::protobuf::rt::string_size(3, &value); + }; + for value in &self.relationships { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.symbol.is_empty() { + os.write_string(1, &self.symbol)?; + } + for v in &self.documentation { + os.write_string(3, &v)?; + }; + for v in &self.relationships { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> SymbolInformation { + SymbolInformation::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "symbol", + |m: &SymbolInformation| { &m.symbol }, + |m: &mut SymbolInformation| { &mut m.symbol }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "documentation", + |m: &SymbolInformation| { &m.documentation }, + |m: &mut SymbolInformation| { &mut m.documentation }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "relationships", + |m: &SymbolInformation| { &m.relationships }, + |m: &mut SymbolInformation| { &mut m.relationships }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "SymbolInformation", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static SymbolInformation { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(SymbolInformation::new) + } +} + +impl ::protobuf::Clear for SymbolInformation { + fn clear(&mut self) { + self.symbol.clear(); + self.documentation.clear(); + self.relationships.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for SymbolInformation { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SymbolInformation { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Relationship { + // message fields + pub symbol: ::std::string::String, + pub is_reference: bool, + pub is_implementation: bool, + pub is_type_definition: bool, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Relationship { + fn default() -> &'a Relationship { + ::default_instance() + } +} + +impl Relationship { + pub fn new() -> Relationship { + ::std::default::Default::default() + } + + // string symbol = 1; + + + pub fn get_symbol(&self) -> &str { + &self.symbol + } + pub fn clear_symbol(&mut self) { + self.symbol.clear(); + } + + // Param is passed by value, moved + pub fn set_symbol(&mut self, v: ::std::string::String) { + self.symbol = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_symbol(&mut self) -> &mut ::std::string::String { + &mut self.symbol + } + + // Take field + pub fn take_symbol(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.symbol, ::std::string::String::new()) + } + + // bool is_reference = 2; + + + pub fn get_is_reference(&self) -> bool { + self.is_reference + } + pub fn clear_is_reference(&mut self) { + self.is_reference = false; + } + + // Param is passed by value, moved + pub fn set_is_reference(&mut self, v: bool) { + self.is_reference = v; + } + + // bool is_implementation = 3; + + + pub fn get_is_implementation(&self) -> bool { + self.is_implementation + } + pub fn clear_is_implementation(&mut self) { + self.is_implementation = false; + } + + // Param is passed by value, moved + pub fn set_is_implementation(&mut self, v: bool) { + self.is_implementation = v; + } + + // bool is_type_definition = 4; + + + pub fn get_is_type_definition(&self) -> bool { + self.is_type_definition + } + pub fn clear_is_type_definition(&mut self) { + self.is_type_definition = false; + } + + // Param is passed by value, moved + pub fn set_is_type_definition(&mut self, v: bool) { + self.is_type_definition = v; + } +} + +impl ::protobuf::Message for Relationship { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.symbol)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.is_reference = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.is_implementation = tmp; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.is_type_definition = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.symbol.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.symbol); + } + if self.is_reference != false { + my_size += 2; + } + if self.is_implementation != false { + my_size += 2; + } + if self.is_type_definition != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.symbol.is_empty() { + os.write_string(1, &self.symbol)?; + } + if self.is_reference != false { + os.write_bool(2, self.is_reference)?; + } + if self.is_implementation != false { + os.write_bool(3, self.is_implementation)?; + } + if self.is_type_definition != false { + os.write_bool(4, self.is_type_definition)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Relationship { + Relationship::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "symbol", + |m: &Relationship| { &m.symbol }, + |m: &mut Relationship| { &mut m.symbol }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "is_reference", + |m: &Relationship| { &m.is_reference }, + |m: &mut Relationship| { &mut m.is_reference }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "is_implementation", + |m: &Relationship| { &m.is_implementation }, + |m: &mut Relationship| { &mut m.is_implementation }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "is_type_definition", + |m: &Relationship| { &m.is_type_definition }, + |m: &mut Relationship| { &mut m.is_type_definition }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Relationship", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Relationship { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Relationship::new) + } +} + +impl ::protobuf::Clear for Relationship { + fn clear(&mut self) { + self.symbol.clear(); + self.is_reference = false; + self.is_implementation = false; + self.is_type_definition = false; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Relationship { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Relationship { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Occurrence { + // message fields + pub range: ::std::vec::Vec, + pub symbol: ::std::string::String, + pub symbol_roles: i32, + pub override_documentation: ::protobuf::RepeatedField<::std::string::String>, + pub syntax_kind: SyntaxKind, + pub diagnostics: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Occurrence { + fn default() -> &'a Occurrence { + ::default_instance() + } +} + +impl Occurrence { + pub fn new() -> Occurrence { + ::std::default::Default::default() + } + + // repeated int32 range = 1; + + + pub fn get_range(&self) -> &[i32] { + &self.range + } + pub fn clear_range(&mut self) { + self.range.clear(); + } + + // Param is passed by value, moved + pub fn set_range(&mut self, v: ::std::vec::Vec) { + self.range = v; + } + + // Mutable pointer to the field. + pub fn mut_range(&mut self) -> &mut ::std::vec::Vec { + &mut self.range + } + + // Take field + pub fn take_range(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.range, ::std::vec::Vec::new()) + } + + // string symbol = 2; + + + pub fn get_symbol(&self) -> &str { + &self.symbol + } + pub fn clear_symbol(&mut self) { + self.symbol.clear(); + } + + // Param is passed by value, moved + pub fn set_symbol(&mut self, v: ::std::string::String) { + self.symbol = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_symbol(&mut self) -> &mut ::std::string::String { + &mut self.symbol + } + + // Take field + pub fn take_symbol(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.symbol, ::std::string::String::new()) + } + + // int32 symbol_roles = 3; + + + pub fn get_symbol_roles(&self) -> i32 { + self.symbol_roles + } + pub fn clear_symbol_roles(&mut self) { + self.symbol_roles = 0; + } + + // Param is passed by value, moved + pub fn set_symbol_roles(&mut self, v: i32) { + self.symbol_roles = v; + } + + // repeated string override_documentation = 4; + + + pub fn get_override_documentation(&self) -> &[::std::string::String] { + &self.override_documentation + } + pub fn clear_override_documentation(&mut self) { + self.override_documentation.clear(); + } + + // Param is passed by value, moved + pub fn set_override_documentation(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.override_documentation = v; + } + + // Mutable pointer to the field. + pub fn mut_override_documentation(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.override_documentation + } + + // Take field + pub fn take_override_documentation(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.override_documentation, ::protobuf::RepeatedField::new()) + } + + // .lib.codeintel.lsiftyped.SyntaxKind syntax_kind = 5; + + + pub fn get_syntax_kind(&self) -> SyntaxKind { + self.syntax_kind + } + pub fn clear_syntax_kind(&mut self) { + self.syntax_kind = SyntaxKind::UnspecifiedSyntaxKind; + } + + // Param is passed by value, moved + pub fn set_syntax_kind(&mut self, v: SyntaxKind) { + self.syntax_kind = v; + } + + // repeated .lib.codeintel.lsiftyped.Diagnostic diagnostics = 6; + + + pub fn get_diagnostics(&self) -> &[Diagnostic] { + &self.diagnostics + } + pub fn clear_diagnostics(&mut self) { + self.diagnostics.clear(); + } + + // Param is passed by value, moved + pub fn set_diagnostics(&mut self, v: ::protobuf::RepeatedField) { + self.diagnostics = v; + } + + // Mutable pointer to the field. + pub fn mut_diagnostics(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.diagnostics + } + + // Take field + pub fn take_diagnostics(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.diagnostics, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for Occurrence { + fn is_initialized(&self) -> bool { + for v in &self.diagnostics { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_int32_into(wire_type, is, &mut self.range)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.symbol)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.symbol_roles = tmp; + }, + 4 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.override_documentation)?; + }, + 5 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.syntax_kind, 5, &mut self.unknown_fields)? + }, + 6 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.diagnostics)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.range { + my_size += ::protobuf::rt::value_size(1, *value, ::protobuf::wire_format::WireTypeVarint); + }; + if !self.symbol.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.symbol); + } + if self.symbol_roles != 0 { + my_size += ::protobuf::rt::value_size(3, self.symbol_roles, ::protobuf::wire_format::WireTypeVarint); + } + for value in &self.override_documentation { + my_size += ::protobuf::rt::string_size(4, &value); + }; + if self.syntax_kind != SyntaxKind::UnspecifiedSyntaxKind { + my_size += ::protobuf::rt::enum_size(5, self.syntax_kind); + } + for value in &self.diagnostics { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + for v in &self.range { + os.write_int32(1, *v)?; + }; + if !self.symbol.is_empty() { + os.write_string(2, &self.symbol)?; + } + if self.symbol_roles != 0 { + os.write_int32(3, self.symbol_roles)?; + } + for v in &self.override_documentation { + os.write_string(4, &v)?; + }; + if self.syntax_kind != SyntaxKind::UnspecifiedSyntaxKind { + os.write_enum(5, ::protobuf::ProtobufEnum::value(&self.syntax_kind))?; + } + for v in &self.diagnostics { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Occurrence { + Occurrence::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "range", + |m: &Occurrence| { &m.range }, + |m: &mut Occurrence| { &mut m.range }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "symbol", + |m: &Occurrence| { &m.symbol }, + |m: &mut Occurrence| { &mut m.symbol }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "symbol_roles", + |m: &Occurrence| { &m.symbol_roles }, + |m: &mut Occurrence| { &mut m.symbol_roles }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "override_documentation", + |m: &Occurrence| { &m.override_documentation }, + |m: &mut Occurrence| { &mut m.override_documentation }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "syntax_kind", + |m: &Occurrence| { &m.syntax_kind }, + |m: &mut Occurrence| { &mut m.syntax_kind }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "diagnostics", + |m: &Occurrence| { &m.diagnostics }, + |m: &mut Occurrence| { &mut m.diagnostics }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Occurrence", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Occurrence { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Occurrence::new) + } +} + +impl ::protobuf::Clear for Occurrence { + fn clear(&mut self) { + self.range.clear(); + self.symbol.clear(); + self.symbol_roles = 0; + self.override_documentation.clear(); + self.syntax_kind = SyntaxKind::UnspecifiedSyntaxKind; + self.diagnostics.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Occurrence { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Occurrence { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Diagnostic { + // message fields + pub severity: Severity, + pub code: ::std::string::String, + pub message: ::std::string::String, + pub source: ::std::string::String, + pub tags: ::std::vec::Vec, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Diagnostic { + fn default() -> &'a Diagnostic { + ::default_instance() + } +} + +impl Diagnostic { + pub fn new() -> Diagnostic { + ::std::default::Default::default() + } + + // .lib.codeintel.lsiftyped.Severity severity = 1; + + + pub fn get_severity(&self) -> Severity { + self.severity + } + pub fn clear_severity(&mut self) { + self.severity = Severity::UnspecifiedSeverity; + } + + // Param is passed by value, moved + pub fn set_severity(&mut self, v: Severity) { + self.severity = v; + } + + // string code = 2; + + + pub fn get_code(&self) -> &str { + &self.code + } + pub fn clear_code(&mut self) { + self.code.clear(); + } + + // Param is passed by value, moved + pub fn set_code(&mut self, v: ::std::string::String) { + self.code = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_code(&mut self) -> &mut ::std::string::String { + &mut self.code + } + + // Take field + pub fn take_code(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.code, ::std::string::String::new()) + } + + // string message = 3; + + + pub fn get_message(&self) -> &str { + &self.message + } + pub fn clear_message(&mut self) { + self.message.clear(); + } + + // Param is passed by value, moved + pub fn set_message(&mut self, v: ::std::string::String) { + self.message = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message(&mut self) -> &mut ::std::string::String { + &mut self.message + } + + // Take field + pub fn take_message(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.message, ::std::string::String::new()) + } + + // string source = 4; + + + pub fn get_source(&self) -> &str { + &self.source + } + pub fn clear_source(&mut self) { + self.source.clear(); + } + + // Param is passed by value, moved + pub fn set_source(&mut self, v: ::std::string::String) { + self.source = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source(&mut self) -> &mut ::std::string::String { + &mut self.source + } + + // Take field + pub fn take_source(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.source, ::std::string::String::new()) + } + + // repeated .lib.codeintel.lsiftyped.DiagnosticTag tags = 5; + + + pub fn get_tags(&self) -> &[DiagnosticTag] { + &self.tags + } + pub fn clear_tags(&mut self) { + self.tags.clear(); + } + + // Param is passed by value, moved + pub fn set_tags(&mut self, v: ::std::vec::Vec) { + self.tags = v; + } + + // Mutable pointer to the field. + pub fn mut_tags(&mut self) -> &mut ::std::vec::Vec { + &mut self.tags + } + + // Take field + pub fn take_tags(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.tags, ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for Diagnostic { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.severity, 1, &mut self.unknown_fields)? + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.code)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.message)?; + }, + 4 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.source)?; + }, + 5 => { + ::protobuf::rt::read_repeated_enum_with_unknown_fields_into(wire_type, is, &mut self.tags, 5, &mut self.unknown_fields)? + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.severity != Severity::UnspecifiedSeverity { + my_size += ::protobuf::rt::enum_size(1, self.severity); + } + if !self.code.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.code); + } + if !self.message.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.message); + } + if !self.source.is_empty() { + my_size += ::protobuf::rt::string_size(4, &self.source); + } + for value in &self.tags { + my_size += ::protobuf::rt::enum_size(5, *value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if self.severity != Severity::UnspecifiedSeverity { + os.write_enum(1, ::protobuf::ProtobufEnum::value(&self.severity))?; + } + if !self.code.is_empty() { + os.write_string(2, &self.code)?; + } + if !self.message.is_empty() { + os.write_string(3, &self.message)?; + } + if !self.source.is_empty() { + os.write_string(4, &self.source)?; + } + for v in &self.tags { + os.write_enum(5, ::protobuf::ProtobufEnum::value(v))?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Diagnostic { + Diagnostic::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "severity", + |m: &Diagnostic| { &m.severity }, + |m: &mut Diagnostic| { &mut m.severity }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "code", + |m: &Diagnostic| { &m.code }, + |m: &mut Diagnostic| { &mut m.code }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "message", + |m: &Diagnostic| { &m.message }, + |m: &mut Diagnostic| { &mut m.message }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "source", + |m: &Diagnostic| { &m.source }, + |m: &mut Diagnostic| { &mut m.source }, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "tags", + |m: &Diagnostic| { &m.tags }, + |m: &mut Diagnostic| { &mut m.tags }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Diagnostic", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Diagnostic { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Diagnostic::new) + } +} + +impl ::protobuf::Clear for Diagnostic { + fn clear(&mut self) { + self.severity = Severity::UnspecifiedSeverity; + self.code.clear(); + self.message.clear(); + self.source.clear(); + self.tags.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Diagnostic { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Diagnostic { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum ProtocolVersion { + UnspecifiedProtocolVersion = 0, +} + +impl ::protobuf::ProtobufEnum for ProtocolVersion { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(ProtocolVersion::UnspecifiedProtocolVersion), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [ProtocolVersion] = &[ + ProtocolVersion::UnspecifiedProtocolVersion, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new_pb_name::("ProtocolVersion", file_descriptor_proto()) + }) + } +} + +impl ::std::marker::Copy for ProtocolVersion { +} + +impl ::std::default::Default for ProtocolVersion { + fn default() -> Self { + ProtocolVersion::UnspecifiedProtocolVersion + } +} + +impl ::protobuf::reflect::ProtobufValue for ProtocolVersion { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum TextEncoding { + UnspecifiedTextEncoding = 0, + UTF8 = 1, + UTF16 = 2, +} + +impl ::protobuf::ProtobufEnum for TextEncoding { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(TextEncoding::UnspecifiedTextEncoding), + 1 => ::std::option::Option::Some(TextEncoding::UTF8), + 2 => ::std::option::Option::Some(TextEncoding::UTF16), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [TextEncoding] = &[ + TextEncoding::UnspecifiedTextEncoding, + TextEncoding::UTF8, + TextEncoding::UTF16, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new_pb_name::("TextEncoding", file_descriptor_proto()) + }) + } +} + +impl ::std::marker::Copy for TextEncoding { +} + +impl ::std::default::Default for TextEncoding { + fn default() -> Self { + TextEncoding::UnspecifiedTextEncoding + } +} + +impl ::protobuf::reflect::ProtobufValue for TextEncoding { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum SymbolRole { + UnspecifiedSymbolRole = 0, + Definition = 1, + Import = 2, + WriteAccess = 4, + ReadAccess = 8, + Generated = 16, + Test = 32, +} + +impl ::protobuf::ProtobufEnum for SymbolRole { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(SymbolRole::UnspecifiedSymbolRole), + 1 => ::std::option::Option::Some(SymbolRole::Definition), + 2 => ::std::option::Option::Some(SymbolRole::Import), + 4 => ::std::option::Option::Some(SymbolRole::WriteAccess), + 8 => ::std::option::Option::Some(SymbolRole::ReadAccess), + 16 => ::std::option::Option::Some(SymbolRole::Generated), + 32 => ::std::option::Option::Some(SymbolRole::Test), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [SymbolRole] = &[ + SymbolRole::UnspecifiedSymbolRole, + SymbolRole::Definition, + SymbolRole::Import, + SymbolRole::WriteAccess, + SymbolRole::ReadAccess, + SymbolRole::Generated, + SymbolRole::Test, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new_pb_name::("SymbolRole", file_descriptor_proto()) + }) + } +} + +impl ::std::marker::Copy for SymbolRole { +} + +impl ::std::default::Default for SymbolRole { + fn default() -> Self { + SymbolRole::UnspecifiedSymbolRole + } +} + +impl ::protobuf::reflect::ProtobufValue for SymbolRole { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum SyntaxKind { + UnspecifiedSyntaxKind = 0, + Comment = 1, + PunctuationDelimiter = 2, + PunctuationBracket = 3, + IdentifierKeyword = 4, + IdentifierOperator = 5, + Identifier = 6, + IdentifierBuiltin = 7, + IdentifierNull = 8, + IdentifierConstant = 9, + IdentifierMutableGlobal = 10, + IdentifierParameter = 11, + IdentifierLocal = 12, + IdentifierShadowed = 13, + IdentifierModule = 14, + IdentifierFunction = 15, + IdentifierFunctionDefinition = 16, + IdentifierMacro = 17, + IdentifierMacroDefinition = 18, + IdentifierType = 19, + IdentifierBuiltinType = 20, + IdentifierAttribute = 21, + RegexEscape = 22, + RegexRepeated = 23, + RegexWildcard = 24, + RegexDelimiter = 25, + RegexJoin = 26, + StringLiteral = 27, + StringLiteralEscape = 28, + StringLiteralSpecial = 29, + StringLiteralKey = 30, + CharacterLiteral = 31, + NumericLiteral = 32, + BooleanLiteral = 33, + Tag = 34, + TagAttribute = 35, + TagDelimiter = 36, +} + +impl ::protobuf::ProtobufEnum for SyntaxKind { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(SyntaxKind::UnspecifiedSyntaxKind), + 1 => ::std::option::Option::Some(SyntaxKind::Comment), + 2 => ::std::option::Option::Some(SyntaxKind::PunctuationDelimiter), + 3 => ::std::option::Option::Some(SyntaxKind::PunctuationBracket), + 4 => ::std::option::Option::Some(SyntaxKind::IdentifierKeyword), + 5 => ::std::option::Option::Some(SyntaxKind::IdentifierOperator), + 6 => ::std::option::Option::Some(SyntaxKind::Identifier), + 7 => ::std::option::Option::Some(SyntaxKind::IdentifierBuiltin), + 8 => ::std::option::Option::Some(SyntaxKind::IdentifierNull), + 9 => ::std::option::Option::Some(SyntaxKind::IdentifierConstant), + 10 => ::std::option::Option::Some(SyntaxKind::IdentifierMutableGlobal), + 11 => ::std::option::Option::Some(SyntaxKind::IdentifierParameter), + 12 => ::std::option::Option::Some(SyntaxKind::IdentifierLocal), + 13 => ::std::option::Option::Some(SyntaxKind::IdentifierShadowed), + 14 => ::std::option::Option::Some(SyntaxKind::IdentifierModule), + 15 => ::std::option::Option::Some(SyntaxKind::IdentifierFunction), + 16 => ::std::option::Option::Some(SyntaxKind::IdentifierFunctionDefinition), + 17 => ::std::option::Option::Some(SyntaxKind::IdentifierMacro), + 18 => ::std::option::Option::Some(SyntaxKind::IdentifierMacroDefinition), + 19 => ::std::option::Option::Some(SyntaxKind::IdentifierType), + 20 => ::std::option::Option::Some(SyntaxKind::IdentifierBuiltinType), + 21 => ::std::option::Option::Some(SyntaxKind::IdentifierAttribute), + 22 => ::std::option::Option::Some(SyntaxKind::RegexEscape), + 23 => ::std::option::Option::Some(SyntaxKind::RegexRepeated), + 24 => ::std::option::Option::Some(SyntaxKind::RegexWildcard), + 25 => ::std::option::Option::Some(SyntaxKind::RegexDelimiter), + 26 => ::std::option::Option::Some(SyntaxKind::RegexJoin), + 27 => ::std::option::Option::Some(SyntaxKind::StringLiteral), + 28 => ::std::option::Option::Some(SyntaxKind::StringLiteralEscape), + 29 => ::std::option::Option::Some(SyntaxKind::StringLiteralSpecial), + 30 => ::std::option::Option::Some(SyntaxKind::StringLiteralKey), + 31 => ::std::option::Option::Some(SyntaxKind::CharacterLiteral), + 32 => ::std::option::Option::Some(SyntaxKind::NumericLiteral), + 33 => ::std::option::Option::Some(SyntaxKind::BooleanLiteral), + 34 => ::std::option::Option::Some(SyntaxKind::Tag), + 35 => ::std::option::Option::Some(SyntaxKind::TagAttribute), + 36 => ::std::option::Option::Some(SyntaxKind::TagDelimiter), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [SyntaxKind] = &[ + SyntaxKind::UnspecifiedSyntaxKind, + SyntaxKind::Comment, + SyntaxKind::PunctuationDelimiter, + SyntaxKind::PunctuationBracket, + SyntaxKind::IdentifierKeyword, + SyntaxKind::IdentifierOperator, + SyntaxKind::Identifier, + SyntaxKind::IdentifierBuiltin, + SyntaxKind::IdentifierNull, + SyntaxKind::IdentifierConstant, + SyntaxKind::IdentifierMutableGlobal, + SyntaxKind::IdentifierParameter, + SyntaxKind::IdentifierLocal, + SyntaxKind::IdentifierShadowed, + SyntaxKind::IdentifierModule, + SyntaxKind::IdentifierFunction, + SyntaxKind::IdentifierFunctionDefinition, + SyntaxKind::IdentifierMacro, + SyntaxKind::IdentifierMacroDefinition, + SyntaxKind::IdentifierType, + SyntaxKind::IdentifierBuiltinType, + SyntaxKind::IdentifierAttribute, + SyntaxKind::RegexEscape, + SyntaxKind::RegexRepeated, + SyntaxKind::RegexWildcard, + SyntaxKind::RegexDelimiter, + SyntaxKind::RegexJoin, + SyntaxKind::StringLiteral, + SyntaxKind::StringLiteralEscape, + SyntaxKind::StringLiteralSpecial, + SyntaxKind::StringLiteralKey, + SyntaxKind::CharacterLiteral, + SyntaxKind::NumericLiteral, + SyntaxKind::BooleanLiteral, + SyntaxKind::Tag, + SyntaxKind::TagAttribute, + SyntaxKind::TagDelimiter, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new_pb_name::("SyntaxKind", file_descriptor_proto()) + }) + } +} + +impl ::std::marker::Copy for SyntaxKind { +} + +impl ::std::default::Default for SyntaxKind { + fn default() -> Self { + SyntaxKind::UnspecifiedSyntaxKind + } +} + +impl ::protobuf::reflect::ProtobufValue for SyntaxKind { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum Severity { + UnspecifiedSeverity = 0, + Error = 1, + Warning = 2, + Information = 3, + Hint = 4, +} + +impl ::protobuf::ProtobufEnum for Severity { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(Severity::UnspecifiedSeverity), + 1 => ::std::option::Option::Some(Severity::Error), + 2 => ::std::option::Option::Some(Severity::Warning), + 3 => ::std::option::Option::Some(Severity::Information), + 4 => ::std::option::Option::Some(Severity::Hint), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [Severity] = &[ + Severity::UnspecifiedSeverity, + Severity::Error, + Severity::Warning, + Severity::Information, + Severity::Hint, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new_pb_name::("Severity", file_descriptor_proto()) + }) + } +} + +impl ::std::marker::Copy for Severity { +} + +impl ::std::default::Default for Severity { + fn default() -> Self { + Severity::UnspecifiedSeverity + } +} + +impl ::protobuf::reflect::ProtobufValue for Severity { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum DiagnosticTag { + UnspecifiedDiagnosticTag = 0, + Unnecessary = 1, + Deprecated = 2, +} + +impl ::protobuf::ProtobufEnum for DiagnosticTag { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(DiagnosticTag::UnspecifiedDiagnosticTag), + 1 => ::std::option::Option::Some(DiagnosticTag::Unnecessary), + 2 => ::std::option::Option::Some(DiagnosticTag::Deprecated), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [DiagnosticTag] = &[ + DiagnosticTag::UnspecifiedDiagnosticTag, + DiagnosticTag::Unnecessary, + DiagnosticTag::Deprecated, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new_pb_name::("DiagnosticTag", file_descriptor_proto()) + }) + } +} + +impl ::std::marker::Copy for DiagnosticTag { +} + +impl ::std::default::Default for DiagnosticTag { + fn default() -> Self { + DiagnosticTag::UnspecifiedDiagnosticTag + } +} + +impl ::protobuf::reflect::ProtobufValue for DiagnosticTag { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\"lib/codeintel/lsiftyped/lsif.proto\x12\x17lib.codeintel.lsiftyped\"\ + \xde\x01\n\x05Index\x12=\n\x08metadata\x18\x01\x20\x01(\x0b2!.lib.codein\ + tel.lsiftyped.MetadataR\x08metadata\x12?\n\tdocuments\x18\x02\x20\x03(\ + \x0b2!.lib.codeintel.lsiftyped.DocumentR\tdocuments\x12U\n\x10external_s\ + ymbols\x18\x03\x20\x03(\x0b2*.lib.codeintel.lsiftyped.SymbolInformationR\ + \x0fexternalSymbols\"\x8e\x02\n\x08Metadata\x12B\n\x07version\x18\x01\ + \x20\x01(\x0e2(.lib.codeintel.lsiftyped.ProtocolVersionR\x07version\x12>\ + \n\ttool_info\x18\x02\x20\x01(\x0b2!.lib.codeintel.lsiftyped.ToolInfoR\ + \x08toolInfo\x12!\n\x0cproject_root\x18\x03\x20\x01(\tR\x0bprojectRoot\ + \x12[\n\x16text_document_encoding\x18\x04\x20\x01(\x0e2%.lib.codeintel.l\ + siftyped.TextEncodingR\x14textDocumentEncoding\"V\n\x08ToolInfo\x12\x12\ + \n\x04name\x18\x01\x20\x01(\tR\x04name\x12\x18\n\x07version\x18\x02\x20\ + \x01(\tR\x07version\x12\x1c\n\targuments\x18\x03\x20\x03(\tR\targuments\ + \"\xbc\x01\n\x08Document\x12#\n\rrelative_path\x18\x01\x20\x01(\tR\x0cre\ + lativePath\x12E\n\x0boccurrences\x18\x02\x20\x03(\x0b2#.lib.codeintel.ls\ + iftyped.OccurrenceR\x0boccurrences\x12D\n\x07symbols\x18\x03\x20\x03(\ + \x0b2*.lib.codeintel.lsiftyped.SymbolInformationR\x07symbols\"\xa3\x01\n\ + \x06Symbol\x12\x16\n\x06scheme\x18\x01\x20\x01(\tR\x06scheme\x12:\n\x07p\ + ackage\x18\x02\x20\x01(\x0b2\x20.lib.codeintel.lsiftyped.PackageR\x07pac\ + kage\x12E\n\x0bdescriptors\x18\x03\x20\x03(\x0b2#.lib.codeintel.lsiftype\ + d.DescriptorR\x0bdescriptors\"Q\n\x07Package\x12\x18\n\x07manager\x18\ + \x01\x20\x01(\tR\x07manager\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04nam\ + e\x12\x18\n\x07version\x18\x03\x20\x01(\tR\x07version\"\x90\x02\n\nDescr\ + iptor\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12$\n\rdisambiguato\ + r\x18\x02\x20\x01(\tR\rdisambiguator\x12B\n\x06suffix\x18\x03\x20\x01(\ + \x0e2*.lib.codeintel.lsiftyped.Descriptor.SuffixR\x06suffix\"\x83\x01\n\ + \x06Suffix\x12\x15\n\x11UnspecifiedSuffix\x10\0\x12\x0b\n\x07Package\x10\ + \x01\x12\x08\n\x04Type\x10\x02\x12\x08\n\x04Term\x10\x03\x12\n\n\x06Meth\ + od\x10\x04\x12\x11\n\rTypeParameter\x10\x05\x12\r\n\tParameter\x10\x06\ + \x12\x08\n\x04Meta\x10\x07\x12\t\n\x05Local\x10\x08\"\x9e\x01\n\x11Symbo\ + lInformation\x12\x16\n\x06symbol\x18\x01\x20\x01(\tR\x06symbol\x12$\n\rd\ + ocumentation\x18\x03\x20\x03(\tR\rdocumentation\x12K\n\rrelationships\ + \x18\x04\x20\x03(\x0b2%.lib.codeintel.lsiftyped.RelationshipR\rrelations\ + hips\"\xa4\x01\n\x0cRelationship\x12\x16\n\x06symbol\x18\x01\x20\x01(\tR\ + \x06symbol\x12!\n\x0cis_reference\x18\x02\x20\x01(\x08R\x0bisReference\ + \x12+\n\x11is_implementation\x18\x03\x20\x01(\x08R\x10isImplementation\ + \x12,\n\x12is_type_definition\x18\x04\x20\x01(\x08R\x10isTypeDefinition\ + \"\xa1\x02\n\nOccurrence\x12\x14\n\x05range\x18\x01\x20\x03(\x05R\x05ran\ + ge\x12\x16\n\x06symbol\x18\x02\x20\x01(\tR\x06symbol\x12!\n\x0csymbol_ro\ + les\x18\x03\x20\x01(\x05R\x0bsymbolRoles\x125\n\x16override_documentatio\ + n\x18\x04\x20\x03(\tR\x15overrideDocumentation\x12D\n\x0bsyntax_kind\x18\ + \x05\x20\x01(\x0e2#.lib.codeintel.lsiftyped.SyntaxKindR\nsyntaxKind\x12E\ + \n\x0bdiagnostics\x18\x06\x20\x03(\x0b2#.lib.codeintel.lsiftyped.Diagnos\ + ticR\x0bdiagnostics\"\xcd\x01\n\nDiagnostic\x12=\n\x08severity\x18\x01\ + \x20\x01(\x0e2!.lib.codeintel.lsiftyped.SeverityR\x08severity\x12\x12\n\ + \x04code\x18\x02\x20\x01(\tR\x04code\x12\x18\n\x07message\x18\x03\x20\ + \x01(\tR\x07message\x12\x16\n\x06source\x18\x04\x20\x01(\tR\x06source\ + \x12:\n\x04tags\x18\x05\x20\x03(\x0e2&.lib.codeintel.lsiftyped.Diagnosti\ + cTagR\x04tags*1\n\x0fProtocolVersion\x12\x1e\n\x1aUnspecifiedProtocolVer\ + sion\x10\0*@\n\x0cTextEncoding\x12\x1b\n\x17UnspecifiedTextEncoding\x10\ + \0\x12\x08\n\x04UTF8\x10\x01\x12\t\n\x05UTF16\x10\x02*}\n\nSymbolRole\ + \x12\x19\n\x15UnspecifiedSymbolRole\x10\0\x12\x0e\n\nDefinition\x10\x01\ + \x12\n\n\x06Import\x10\x02\x12\x0f\n\x0bWriteAccess\x10\x04\x12\x0e\n\nR\ + eadAccess\x10\x08\x12\r\n\tGenerated\x10\x10\x12\x08\n\x04Test\x10\x20*\ + \xb8\x06\n\nSyntaxKind\x12\x19\n\x15UnspecifiedSyntaxKind\x10\0\x12\x0b\ + \n\x07Comment\x10\x01\x12\x18\n\x14PunctuationDelimiter\x10\x02\x12\x16\ + \n\x12PunctuationBracket\x10\x03\x12\x15\n\x11IdentifierKeyword\x10\x04\ + \x12\x16\n\x12IdentifierOperator\x10\x05\x12\x0e\n\nIdentifier\x10\x06\ + \x12\x15\n\x11IdentifierBuiltin\x10\x07\x12\x12\n\x0eIdentifierNull\x10\ + \x08\x12\x16\n\x12IdentifierConstant\x10\t\x12\x1b\n\x17IdentifierMutabl\ + eGlobal\x10\n\x12\x17\n\x13IdentifierParameter\x10\x0b\x12\x13\n\x0fIden\ + tifierLocal\x10\x0c\x12\x16\n\x12IdentifierShadowed\x10\r\x12\x14\n\x10I\ + dentifierModule\x10\x0e\x12\x16\n\x12IdentifierFunction\x10\x0f\x12\x20\ + \n\x1cIdentifierFunctionDefinition\x10\x10\x12\x13\n\x0fIdentifierMacro\ + \x10\x11\x12\x1d\n\x19IdentifierMacroDefinition\x10\x12\x12\x12\n\x0eIde\ + ntifierType\x10\x13\x12\x19\n\x15IdentifierBuiltinType\x10\x14\x12\x17\n\ + \x13IdentifierAttribute\x10\x15\x12\x0f\n\x0bRegexEscape\x10\x16\x12\x11\ + \n\rRegexRepeated\x10\x17\x12\x11\n\rRegexWildcard\x10\x18\x12\x12\n\x0e\ + RegexDelimiter\x10\x19\x12\r\n\tRegexJoin\x10\x1a\x12\x11\n\rStringLiter\ + al\x10\x1b\x12\x17\n\x13StringLiteralEscape\x10\x1c\x12\x18\n\x14StringL\ + iteralSpecial\x10\x1d\x12\x14\n\x10StringLiteralKey\x10\x1e\x12\x14\n\ + \x10CharacterLiteral\x10\x1f\x12\x12\n\x0eNumericLiteral\x10\x20\x12\x12\ + \n\x0eBooleanLiteral\x10!\x12\x07\n\x03Tag\x10\"\x12\x10\n\x0cTagAttribu\ + te\x10#\x12\x10\n\x0cTagDelimiter\x10$*V\n\x08Severity\x12\x17\n\x13Unsp\ + ecifiedSeverity\x10\0\x12\t\n\x05Error\x10\x01\x12\x0b\n\x07Warning\x10\ + \x02\x12\x0f\n\x0bInformation\x10\x03\x12\x08\n\x04Hint\x10\x04*N\n\rDia\ + gnosticTag\x12\x1c\n\x18UnspecifiedDiagnosticTag\x10\0\x12\x0f\n\x0bUnne\ + cessary\x10\x01\x12\x0e\n\nDeprecated\x10\x02B=Z;github.com/sourcegraph/\ + sourcegraph/lib/codeintel/lsiftyped/J\xb9\x7f\n\x07\x12\x05\n\0\xf2\x02\ + \x01\n\x82\x04\n\x01\x0c\x12\x03\n\0\x122\xf7\x03\x20An\x20index\x20cont\ + ains\x20one\x20or\x20more\x20pieces\x20of\x20information\x20about\x20a\ + \x20given\x20piece\x20of\n\x20source\x20code\x20or\x20software\x20artifa\ + ct.\x20Complementary\x20information\x20can\x20be\x20merged\n\x20together\ + \x20from\x20multiple\x20sources\x20to\x20provide\x20a\x20unified\x20code\ + \x20intelligence\n\x20experience.\n\n\x20Programs\x20producing\x20a\x20f\ + ile\x20of\x20this\x20format\x20is\x20an\x20\"indexer\"\x20and\x20may\x20\ + operate\n\x20somewhere\x20on\x20the\x20spectrum\x20between\x20precision,\ + \x20such\x20as\x20indexes\x20produced\x20by\n\x20compiler-backed\x20inde\ + xers,\x20and\x20heurstics,\x20such\x20as\x20indexes\x20produced\x20by\ + \x20local\n\x20syntax-directed\x20analysis\x20for\x20scope\x20rules.\n\n\ + \x08\n\x01\x02\x12\x03\x0c\0\x20\n\x08\n\x01\x08\x12\x03\x0e\0R\n\t\n\ + \x02\x08\x0b\x12\x03\x0e\0R\n\xd1\x03\n\x02\x04\0\x12\x04\x16\0!\x01\x1a\ + \xc4\x03\x20Index\x20represents\x20a\x20complete\x20LSIF\x20index\x20for\ + \x20a\x20workspace\x20this\x20is\x20rooted\x20at\x20a\n\x20single\x20dir\ + ectory.\x20An\x20Index\x20message\x20payload\x20can\x20have\x20a\x20larg\ + e\x20memory\x20footprint\n\x20and\x20it's\x20therefore\x20recommended\ + \x20to\x20emit\x20and\x20consume\x20an\x20Index\x20payload\x20one\x20fie\ + ld\n\x20value\x20at\x20a\x20time.\x20\x20To\x20permit\x20streaming\x20co\ + nsumption\x20of\x20an\x20Index\x20payload,\x20the\n\x20`metadata`\x20fie\ + ld\x20must\x20appear\x20at\x20the\x20start\x20of\x20the\x20stream\x20and\ + \x20must\x20only\x20appear\n\x20once\x20in\x20the\x20stream.\x20Other\ + \x20field\x20values\x20may\x20appear\x20in\x20any\x20order.\n\n\n\n\x03\ + \x04\0\x01\x12\x03\x16\x08\r\n)\n\x04\x04\0\x02\0\x12\x03\x18\x02\x18\ + \x1a\x1c\x20Metadata\x20about\x20this\x20index.\n\n\x0c\n\x05\x04\0\x02\ + \0\x06\x12\x03\x18\x02\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x18\x0b\x13\ + \n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x18\x16\x17\n3\n\x04\x04\0\x02\x01\ + \x12\x03\x1a\x02\"\x1a&\x20Documents\x20that\x20belong\x20to\x20this\x20\ + index.\n\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\x1a\x02\n\n\x0c\n\x05\x04\ + \0\x02\x01\x06\x12\x03\x1a\x0b\x13\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\ + \x1a\x14\x1d\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x1a\x20!\n\xf8\x02\n\ + \x04\x04\0\x02\x02\x12\x03\x20\x022\x1a\xea\x02\x20(optional)\x20Symbols\ + \x20that\x20are\x20referenced\x20from\x20this\x20index\x20but\x20are\x20\ + defined\x20in\n\x20an\x20external\x20package\x20(a\x20separate\x20`Index\ + `\x20message).\x20\x20Leave\x20this\x20field\x20empty\n\x20if\x20you\x20\ + assume\x20the\x20external\x20package\x20will\x20get\x20indexed\x20separa\ + tely.\x20If\x20the\n\x20external\x20package\x20won't\x20get\x20indexed\ + \x20for\x20some\x20reason\x20then\x20you\x20can\x20use\x20this\n\x20fiel\ + d\x20to\x20provide\x20hover\x20documentation\x20for\x20those\x20external\ + \x20symbols.\n\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x03\x20\x02\n\n\x0c\n\ + \x05\x04\0\x02\x02\x06\x12\x03\x20\x0b\x1c\n\x0c\n\x05\x04\0\x02\x02\x01\ + \x12\x03\x20\x1d-\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x2001\n\n\n\x02\ + \x04\x01\x12\x04#\0/\x01\n\n\n\x03\x04\x01\x01\x12\x03#\x08\x10\nN\n\x04\ + \x04\x01\x02\0\x12\x03%\x02\x1e\x1aA\x20Which\x20version\x20of\x20this\ + \x20protocol\x20was\x20used\x20to\x20generate\x20this\x20index?\n\n\x0c\ + \n\x05\x04\x01\x02\0\x06\x12\x03%\x02\x11\n\x0c\n\x05\x04\x01\x02\0\x01\ + \x12\x03%\x12\x19\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03%\x1c\x1d\nC\n\ + \x04\x04\x01\x02\x01\x12\x03'\x02\x19\x1a6\x20Information\x20about\x20th\ + e\x20tool\x20that\x20produced\x20this\x20index.\n\n\x0c\n\x05\x04\x01\ + \x02\x01\x06\x12\x03'\x02\n\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03'\x0b\ + \x14\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03'\x17\x18\n\xa2\x01\n\x04\ + \x04\x01\x02\x02\x12\x03+\x02\x1a\x1a\x94\x01\x20URI-encoded\x20absolute\ + \x20path\x20to\x20the\x20root\x20directory\x20of\x20this\x20index.\x20Al\ + l\n\x20documents\x20in\x20this\x20index\x20must\x20appear\x20in\x20a\x20\ + subdirectory\x20of\x20this\x20root\n\x20directory.\n\n\x0c\n\x05\x04\x01\ + \x02\x02\x05\x12\x03+\x02\x08\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03+\t\ + \x15\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03+\x18\x19\nl\n\x04\x04\x01\ + \x02\x03\x12\x03.\x02*\x1a_\x20Text\x20encoding\x20of\x20the\x20source\ + \x20files\x20on\x20disk\x20that\x20are\x20referenced\x20from\n\x20`Docum\ + ent.relative_path`.\n\n\x0c\n\x05\x04\x01\x02\x03\x06\x12\x03.\x02\x0e\n\ + \x0c\n\x05\x04\x01\x02\x03\x01\x12\x03.\x0f%\n\x0c\n\x05\x04\x01\x02\x03\ + \x03\x12\x03.()\n\n\n\x02\x05\0\x12\x041\03\x01\n\n\n\x03\x05\0\x01\x12\ + \x031\x05\x14\n\x0b\n\x04\x05\0\x02\0\x12\x032\x04#\n\x0c\n\x05\x05\0\ + \x02\0\x01\x12\x032\x04\x1e\n\x0c\n\x05\x05\0\x02\0\x02\x12\x032!\"\n\n\ + \n\x02\x05\x01\x12\x045\09\x01\n\n\n\x03\x05\x01\x01\x12\x035\x05\x11\n\ + \x0b\n\x04\x05\x01\x02\0\x12\x036\x02\x1e\n\x0c\n\x05\x05\x01\x02\0\x01\ + \x12\x036\x02\x19\n\x0c\n\x05\x05\x01\x02\0\x02\x12\x036\x1c\x1d\n\x0b\n\ + \x04\x05\x01\x02\x01\x12\x037\x02\x0b\n\x0c\n\x05\x05\x01\x02\x01\x01\ + \x12\x037\x02\x06\n\x0c\n\x05\x05\x01\x02\x01\x02\x12\x037\t\n\n\x0b\n\ + \x04\x05\x01\x02\x02\x12\x038\x02\x0c\n\x0c\n\x05\x05\x01\x02\x02\x01\ + \x12\x038\x02\x07\n\x0c\n\x05\x05\x01\x02\x02\x02\x12\x038\n\x0b\n\n\n\ + \x02\x04\x02\x12\x04;\0B\x01\n\n\n\x03\x04\x02\x01\x12\x03;\x08\x10\n<\n\ + \x04\x04\x02\x02\0\x12\x03=\x02\x12\x1a/\x20Name\x20of\x20the\x20indexer\ + \x20that\x20produced\x20this\x20index.\n\n\x0c\n\x05\x04\x02\x02\0\x05\ + \x12\x03=\x02\x08\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03=\t\r\n\x0c\n\x05\ + \x04\x02\x02\0\x03\x12\x03=\x10\x11\n?\n\x04\x04\x02\x02\x01\x12\x03?\ + \x02\x15\x1a2\x20Version\x20of\x20the\x20indexer\x20that\x20produced\x20\ + this\x20index.\n\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03?\x02\x08\n\x0c\ + \n\x05\x04\x02\x02\x01\x01\x12\x03?\t\x10\n\x0c\n\x05\x04\x02\x02\x01\ + \x03\x12\x03?\x13\x14\nL\n\x04\x04\x02\x02\x02\x12\x03A\x02\x20\x1a?\x20\ + Command-line\x20arguments\x20that\x20were\x20used\x20to\x20invoke\x20thi\ + s\x20indexer.\n\n\x0c\n\x05\x04\x02\x02\x02\x04\x12\x03A\x02\n\n\x0c\n\ + \x05\x04\x02\x02\x02\x05\x12\x03A\x0b\x11\n\x0c\n\x05\x04\x02\x02\x02\ + \x01\x12\x03A\x12\x1b\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03A\x1e\x1f\n\ + H\n\x02\x04\x03\x12\x04E\0N\x01\x1a<\x20Document\x20defines\x20the\x20me\ + tadata\x20about\x20a\x20source\x20file\x20on\x20disk.\n\n\n\n\x03\x04\ + \x03\x01\x12\x03E\x08\x10\n\xcd\x01\n\x04\x04\x03\x02\0\x12\x03I\x02\x1b\ + \x1a\xbf\x01\x20(Required)\x20Path\x20to\x20the\x20text\x20document\x20r\ + elative\x20to\x20the\x20directory\x20supplied\x20in\n\x20the\x20associat\ + ed\x20`Metadata.project_root`.\x20Not\x20URI-encoded.\x20This\x20value\ + \x20should\n\x20not\x20begin\x20with\x20a\x20directory\x20separator.\n\n\ + \x0c\n\x05\x04\x03\x02\0\x05\x12\x03I\x02\x08\n\x0c\n\x05\x04\x03\x02\0\ + \x01\x12\x03I\t\x16\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03I\x19\x1a\n4\n\ + \x04\x04\x03\x02\x01\x12\x03K\x02&\x1a'\x20Occurrences\x20that\x20appear\ + \x20in\x20this\x20file.\n\n\x0c\n\x05\x04\x03\x02\x01\x04\x12\x03K\x02\n\ + \n\x0c\n\x05\x04\x03\x02\x01\x06\x12\x03K\x0b\x15\n\x0c\n\x05\x04\x03\ + \x02\x01\x01\x12\x03K\x16!\n\x0c\n\x05\x04\x03\x02\x01\x03\x12\x03K$%\n=\ + \n\x04\x04\x03\x02\x02\x12\x03M\x02)\x1a0\x20Symbols\x20that\x20are\x20d\ + efined\x20within\x20this\x20document.\n\n\x0c\n\x05\x04\x03\x02\x02\x04\ + \x12\x03M\x02\n\n\x0c\n\x05\x04\x03\x02\x02\x06\x12\x03M\x0b\x1c\n\x0c\n\ + \x05\x04\x03\x02\x02\x01\x12\x03M\x1d$\n\x0c\n\x05\x04\x03\x02\x02\x03\ + \x12\x03M'(\n\xe7\x0c\n\x02\x04\x04\x12\x04m\0q\x01\x1a\xda\x0c\x20Symbo\ + l\x20is\x20similar\x20to\x20a\x20URI,\x20it\x20identifies\x20a\x20class,\ + \x20method,\x20or\x20a\x20local\n\x20variable.\x20`SymbolInformation`\ + \x20contains\x20rich\x20metadata\x20about\x20symbols\x20such\x20as\n\x20\ + the\x20docstring.\n\n\x20Symbol\x20has\x20a\x20standardized\x20string\ + \x20representation,\x20which\x20can\x20be\x20used\n\x20interchangeably\ + \x20with\x20`Symbol`.\x20The\x20syntax\x20for\x20Symbol\x20is\x20the\x20\ + following:\n\x20```\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\ + \x20\x20\x20\x20\x20\x20\x20\x20::=\x20\x20'\x20'\x20\ + \x20'\x20'\x20{\x20\x20}\x20|\x20'local\x20'\x20\n\ + \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\ + \x20\x20::=\x20\x20'\x20'\x20\x20'\x20'\x20\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\ + \x20\x20\x20\x20::=\x20any\x20UTF-8,\x20escape\x20spaces\x20with\x20doub\ + le\x20space.\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\ + \x20\x20\x20\x20\x20::=\x20same\x20as\x20above,\x20use\x20the\x20placeho\ + lder\x20'.'\x20to\x20indicate\x20an\x20empty\x20value\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20::=\x20same\x20as\x20above\ + \n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\ + \x20\x20::=\x20same\x20as\x20above\n\x20\x20\x20\x20\x20\x20\ + \x20\x20\x20\x20\x20\x20\x20\x20::=\x20\x20|\x20\x20|\x20\ + \x20|\x20\x20|\x20\x20|\x20\x20\ + |\x20\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\ + \x20\x20\x20\x20\x20::=\x20\x20'/'\n\x20\x20\x20\x20\x20\x20\ + \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20::=\x20\ + \x20'#'\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\ + \x20\x20\x20\x20\x20\x20::=\x20\x20'.'\n\x20\x20\x20\x20\x20\ + \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20::=\x20\x20':'\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\ + \x20\x20\x20\x20\x20::=\x20\x20'('\x20\x20')\ + .'\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20::=\x20'['\ + \x20\x20']'\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\ + \x20\x20\x20\x20\x20::=\x20'('\x20\x20')'\n\x20\x20\x20\x20\ + \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20::=\x20<\ + identifier>\n\x20\x20\x20\x20::=\x20\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\ + \x20::=\x20\x20|\x20\n\x20\x20\ + \x20\x20\x20\x20\x20::=\x20{\x20\x20}\n\x20\x20\x20\x20::=\x20'_'\x20|\x20'+'\x20\ + |\x20'-'\x20|\x20'$'\x20|\x20ASCII\x20letter\x20or\x20digit\n\x20\x20\ + \x20\x20\x20\x20::=\x20'`'\x20{\x20\x20}\x20'`'\n\x20\x20\x20\x20\x20\x20::=\x20any\ + \x20UTF-8\x20character,\x20escape\x20backticks\x20with\x20double\x20back\ + tick.\n\x20```\n\n\n\n\x03\x04\x04\x01\x12\x03m\x08\x0e\n\x0b\n\x04\x04\ + \x04\x02\0\x12\x03n\x04\x16\n\x0c\n\x05\x04\x04\x02\0\x05\x12\x03n\x04\n\ + \n\x0c\n\x05\x04\x04\x02\0\x01\x12\x03n\x0b\x11\n\x0c\n\x05\x04\x04\x02\ + \0\x03\x12\x03n\x14\x15\n\x0b\n\x04\x04\x04\x02\x01\x12\x03o\x04\x18\n\ + \x0c\n\x05\x04\x04\x02\x01\x06\x12\x03o\x04\x0b\n\x0c\n\x05\x04\x04\x02\ + \x01\x01\x12\x03o\x0c\x13\n\x0c\n\x05\x04\x04\x02\x01\x03\x12\x03o\x16\ + \x17\n\x0b\n\x04\x04\x04\x02\x02\x12\x03p\x04(\n\x0c\n\x05\x04\x04\x02\ + \x02\x04\x12\x03p\x04\x0c\n\x0c\n\x05\x04\x04\x02\x02\x06\x12\x03p\r\x17\ + \n\x0c\n\x05\x04\x04\x02\x02\x01\x12\x03p\x18#\n\x0c\n\x05\x04\x04\x02\ + \x02\x03\x12\x03p&'\n\n\n\x02\x04\x05\x12\x04s\0w\x01\n\n\n\x03\x04\x05\ + \x01\x12\x03s\x08\x0f\n\x0b\n\x04\x04\x05\x02\0\x12\x03t\x04\x17\n\x0c\n\ + \x05\x04\x05\x02\0\x05\x12\x03t\x04\n\n\x0c\n\x05\x04\x05\x02\0\x01\x12\ + \x03t\x0b\x12\n\x0c\n\x05\x04\x05\x02\0\x03\x12\x03t\x15\x16\n\x0b\n\x04\ + \x04\x05\x02\x01\x12\x03u\x04\x14\n\x0c\n\x05\x04\x05\x02\x01\x05\x12\ + \x03u\x04\n\n\x0c\n\x05\x04\x05\x02\x01\x01\x12\x03u\x0b\x0f\n\x0c\n\x05\ + \x04\x05\x02\x01\x03\x12\x03u\x12\x13\n\x0b\n\x04\x04\x05\x02\x02\x12\ + \x03v\x04\x17\n\x0c\n\x05\x04\x05\x02\x02\x05\x12\x03v\x04\n\n\x0c\n\x05\ + \x04\x05\x02\x02\x01\x12\x03v\x0b\x12\n\x0c\n\x05\x04\x05\x02\x02\x03\ + \x12\x03v\x15\x16\n\x0b\n\x02\x04\x06\x12\x05y\0\x89\x01\x01\n\n\n\x03\ + \x04\x06\x01\x12\x03y\x08\x12\n\r\n\x04\x04\x06\x04\0\x12\x05z\x04\x85\ + \x01\x05\n\x0c\n\x05\x04\x06\x04\0\x01\x12\x03z\t\x0f\n\r\n\x06\x04\x06\ + \x04\0\x02\0\x12\x03{\x08\x1e\n\x0e\n\x07\x04\x06\x04\0\x02\0\x01\x12\ + \x03{\x08\x19\n\x0e\n\x07\x04\x06\x04\0\x02\0\x02\x12\x03{\x1c\x1d\n\r\n\ + \x06\x04\x06\x04\0\x02\x01\x12\x03|\x08\x14\n\x0e\n\x07\x04\x06\x04\0\ + \x02\x01\x01\x12\x03|\x08\x0f\n\x0e\n\x07\x04\x06\x04\0\x02\x01\x02\x12\ + \x03|\x12\x13\n\r\n\x06\x04\x06\x04\0\x02\x02\x12\x03}\x08\x11\n\x0e\n\ + \x07\x04\x06\x04\0\x02\x02\x01\x12\x03}\x08\x0c\n\x0e\n\x07\x04\x06\x04\ + \0\x02\x02\x02\x12\x03}\x0f\x10\n\r\n\x06\x04\x06\x04\0\x02\x03\x12\x03~\ + \x08\x11\n\x0e\n\x07\x04\x06\x04\0\x02\x03\x01\x12\x03~\x08\x0c\n\x0e\n\ + \x07\x04\x06\x04\0\x02\x03\x02\x12\x03~\x0f\x10\n\r\n\x06\x04\x06\x04\0\ + \x02\x04\x12\x03\x7f\x08\x13\n\x0e\n\x07\x04\x06\x04\0\x02\x04\x01\x12\ + \x03\x7f\x08\x0e\n\x0e\n\x07\x04\x06\x04\0\x02\x04\x02\x12\x03\x7f\x11\ + \x12\n\x0e\n\x06\x04\x06\x04\0\x02\x05\x12\x04\x80\x01\x08\x1a\n\x0f\n\ + \x07\x04\x06\x04\0\x02\x05\x01\x12\x04\x80\x01\x08\x15\n\x0f\n\x07\x04\ + \x06\x04\0\x02\x05\x02\x12\x04\x80\x01\x18\x19\n\x0e\n\x06\x04\x06\x04\0\ + \x02\x06\x12\x04\x81\x01\x08\x16\n\x0f\n\x07\x04\x06\x04\0\x02\x06\x01\ + \x12\x04\x81\x01\x08\x11\n\x0f\n\x07\x04\x06\x04\0\x02\x06\x02\x12\x04\ + \x81\x01\x14\x15\n.\n\x06\x04\x06\x04\0\x02\x07\x12\x04\x83\x01\x08\x11\ + \x1a\x1e\x20Can\x20be\x20used\x20for\x20any\x20purpose.\n\n\x0f\n\x07\ + \x04\x06\x04\0\x02\x07\x01\x12\x04\x83\x01\x08\x0c\n\x0f\n\x07\x04\x06\ + \x04\0\x02\x07\x02\x12\x04\x83\x01\x0f\x10\n\x0e\n\x06\x04\x06\x04\0\x02\ + \x08\x12\x04\x84\x01\x08\x12\n\x0f\n\x07\x04\x06\x04\0\x02\x08\x01\x12\ + \x04\x84\x01\x08\r\n\x0f\n\x07\x04\x06\x04\0\x02\x08\x02\x12\x04\x84\x01\ + \x10\x11\n\x0c\n\x04\x04\x06\x02\0\x12\x04\x86\x01\x04\x14\n\r\n\x05\x04\ + \x06\x02\0\x05\x12\x04\x86\x01\x04\n\n\r\n\x05\x04\x06\x02\0\x01\x12\x04\ + \x86\x01\x0b\x0f\n\r\n\x05\x04\x06\x02\0\x03\x12\x04\x86\x01\x12\x13\n\ + \x0c\n\x04\x04\x06\x02\x01\x12\x04\x87\x01\x04\x1d\n\r\n\x05\x04\x06\x02\ + \x01\x05\x12\x04\x87\x01\x04\n\n\r\n\x05\x04\x06\x02\x01\x01\x12\x04\x87\ + \x01\x0b\x18\n\r\n\x05\x04\x06\x02\x01\x03\x12\x04\x87\x01\x1b\x1c\n\x0c\ + \n\x04\x04\x06\x02\x02\x12\x04\x88\x01\x04\x16\n\r\n\x05\x04\x06\x02\x02\ + \x06\x12\x04\x88\x01\x04\n\n\r\n\x05\x04\x06\x02\x02\x01\x12\x04\x88\x01\ + \x0b\x11\n\r\n\x05\x04\x06\x02\x02\x03\x12\x04\x88\x01\x14\x15\n\x83\x01\ + \n\x02\x04\x07\x12\x06\x8d\x01\0\x98\x01\x01\x1au\x20SymbolInformation\ + \x20defines\x20metadata\x20about\x20a\x20symbol,\x20such\x20as\x20the\ + \x20symbol's\n\x20docstring\x20or\x20what\x20package\x20it's\x20defined\ + \x20it.\n\n\x0b\n\x03\x04\x07\x01\x12\x04\x8d\x01\x08\x19\n\xa0\x01\n\ + \x04\x04\x07\x02\0\x12\x04\x90\x01\x02\x14\x1a\x91\x01\x20Identifier\x20\ + of\x20this\x20symbol,\x20which\x20can\x20be\x20referenced\x20from\x20`Oc\ + curence.symbol`.\n\x20The\x20string\x20must\x20be\x20formatted\x20accord\ + ing\x20to\x20the\x20grammar\x20in\x20`Symbol`.\n\n\r\n\x05\x04\x07\x02\0\ + \x05\x12\x04\x90\x01\x02\x08\n\r\n\x05\x04\x07\x02\0\x01\x12\x04\x90\x01\ + \t\x0f\n\r\n\x05\x04\x07\x02\0\x03\x12\x04\x90\x01\x12\x13\n\xb6\x02\n\ + \x04\x04\x07\x02\x01\x12\x04\x95\x01\x02$\x1a\xa7\x02\x20(optional,\x20b\ + ut\x20strongly\x20recommended)\x20The\x20markdown-formatted\x20documenta\ + tion\n\x20for\x20this\x20symbol.\x20This\x20field\x20is\x20repeated\x20t\ + o\x20allow\x20different\x20kinds\x20of\n\x20documentation.\x20\x20For\ + \x20example,\x20it's\x20nice\x20to\x20include\x20both\x20the\x20signatur\ + e\x20of\x20a\n\x20method\x20(parameters\x20and\x20return\x20type)\x20alo\ + ng\x20with\x20the\x20accompanying\x20docstring.\n\n\r\n\x05\x04\x07\x02\ + \x01\x04\x12\x04\x95\x01\x02\n\n\r\n\x05\x04\x07\x02\x01\x05\x12\x04\x95\ + \x01\x0b\x11\n\r\n\x05\x04\x07\x02\x01\x01\x12\x04\x95\x01\x12\x1f\n\r\n\ + \x05\x04\x07\x02\x01\x03\x12\x04\x95\x01\"#\n^\n\x04\x04\x07\x02\x02\x12\ + \x04\x97\x01\x02*\x1aP\x20(optional)\x20Relationships\x20to\x20other\x20\ + symbols\x20(e.g.,\x20implements,\x20type\x20definition).\n\n\r\n\x05\x04\ + \x07\x02\x02\x04\x12\x04\x97\x01\x02\n\n\r\n\x05\x04\x07\x02\x02\x06\x12\ + \x04\x97\x01\x0b\x17\n\r\n\x05\x04\x07\x02\x02\x01\x12\x04\x97\x01\x18%\ + \n\r\n\x05\x04\x07\x02\x02\x03\x12\x04\x97\x01()\n\x0c\n\x02\x04\x08\x12\ + \x06\x9a\x01\0\xc0\x01\x01\n\x0b\n\x03\x04\x08\x01\x12\x04\x9a\x01\x08\ + \x14\n\x0c\n\x04\x04\x08\x02\0\x12\x04\x9b\x01\x04\x16\n\r\n\x05\x04\x08\ + \x02\0\x05\x12\x04\x9b\x01\x04\n\n\r\n\x05\x04\x08\x02\0\x01\x12\x04\x9b\ + \x01\x0b\x11\n\r\n\x05\x04\x08\x02\0\x03\x12\x04\x9b\x01\x14\x15\n\x8f\ + \x08\n\x04\x04\x08\x02\x01\x12\x04\xb4\x01\x04\x1a\x1a\x80\x08\x20When\ + \x20resolving\x20\"Find\x20references\",\x20this\x20field\x20documents\ + \x20what\x20other\x20symbols\n\x20should\x20be\x20included\x20together\ + \x20with\x20this\x20symbol.\x20For\x20example,\x20consider\x20the\n\x20f\ + ollowing\x20TypeScript\x20code\x20that\x20defines\x20two\x20symbols\x20`\ + Animal#sound()`\x20and\n\x20`Dog#sound()`:\n\x20```ts\n\x20interface\x20\ + Animal\x20{\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20^^^^^^\x20defin\ + ition\x20Animal#\n\x20\x20\x20sound():\x20string\n\x20\x20\x20^^^^^\x20d\ + efinition\x20Animal#sound()\n\x20}\n\x20class\x20Dog\x20implements\x20An\ + imal\x20{\n\x20\x20\x20\x20\x20\x20\x20^^^\x20definition\x20Dog#,\x20imp\ + lementation_symbols\x20=\x20Animal#\n\x20\x20\x20public\x20sound():\x20s\ + tring\x20{\x20return\x20\"woof\"\x20}\n\x20\x20\x20\x20\x20\x20\x20\x20\ + \x20\x20^^^^^\x20definition\x20Dog#sound(),\x20references_symbols\x20=\ + \x20Animal#sound(),\x20implementation_symbols\x20=\x20Animal#sound()\n\ + \x20}\n\x20const\x20animal:\x20Animal\x20=\x20new\x20Dog()\n\x20\x20\x20\ + \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20^^^^^^\x20reference\x20A\ + nimal#\n\x20console.log(animal.sound())\n\x20\x20\x20\x20\x20\x20\x20\ + \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20^^^^^\x20reference\ + \x20Animal#sound()\n\x20```\n\x20Doing\x20\"Find\x20references\"\x20on\ + \x20the\x20symbol\x20`Animal#sound()`\x20should\x20return\n\x20reference\ + s\x20to\x20the\x20`Dog#sound()`\x20method\x20as\x20well.\x20Vice-versa,\ + \x20doing\x20\"Find\n\x20references\"\x20on\x20the\x20`Dog#sound()`\x20m\ + ethod\x20should\x20include\x20references\x20to\x20the\n\x20`Animal#sound\ + ()`\x20method\x20as\x20well.\n\n\r\n\x05\x04\x08\x02\x01\x05\x12\x04\xb4\ + \x01\x04\x08\n\r\n\x05\x04\x08\x02\x01\x01\x12\x04\xb4\x01\t\x15\n\r\n\ + \x05\x04\x08\x02\x01\x03\x12\x04\xb4\x01\x18\x19\n\xba\x04\n\x04\x04\x08\ + \x02\x02\x12\x04\xbd\x01\x04\x1f\x1a\xab\x04\x20Similar\x20to\x20`refere\ + nces_symbols`\x20but\x20for\x20\"Go\x20to\x20implementation\".\n\x20It's\ + \x20common\x20for\x20the\x20`implementation_symbols`\x20and\x20`referenc\ + es_symbols`\x20fields\n\x20have\x20the\x20same\x20values\x20but\x20that'\ + s\x20not\x20always\x20the\x20case.\n\x20In\x20the\x20TypeScript\x20examp\ + le\x20above,\x20observe\x20that\x20`implementation_symbols`\x20has\n\x20\ + the\x20value\x20`\"Animal#\"`\x20for\x20the\x20\"Dog#\"\x20symbol\x20whi\ + le\x20`references_symbols`\x20is\n\x20empty.\x20When\x20requesting\x20\"\ + Find\x20references\"\x20on\x20the\x20\"Animal#\"\x20symbol\x20we\x20don'\ + t\n\x20want\x20to\x20include\x20references\x20to\x20\"Dog#\"\x20even\x20\ + if\x20\"Go\x20to\x20implementation\"\x20on\x20the\n\x20\"Animal#\"\x20sy\ + mbol\x20should\x20navigate\x20to\x20the\x20\"Dog#\"\x20symbol.\n\n\r\n\ + \x05\x04\x08\x02\x02\x05\x12\x04\xbd\x01\x04\x08\n\r\n\x05\x04\x08\x02\ + \x02\x01\x12\x04\xbd\x01\t\x1a\n\r\n\x05\x04\x08\x02\x02\x03\x12\x04\xbd\ + \x01\x1d\x1e\nP\n\x04\x04\x08\x02\x03\x12\x04\xbf\x01\x04\x20\x1aB\x20Si\ + milar\x20to\x20`references_symbols`\x20but\x20for\x20\"Go\x20to\x20type\ + \x20definition\".\n\n\r\n\x05\x04\x08\x02\x03\x05\x12\x04\xbf\x01\x04\ + \x08\n\r\n\x05\x04\x08\x02\x03\x01\x12\x04\xbf\x01\t\x1b\n\r\n\x05\x04\ + \x08\x02\x03\x03\x12\x04\xbf\x01\x1e\x1f\n\x8a\x03\n\x02\x05\x02\x12\x06\ + \xc7\x01\0\xd5\x01\x01\x1a\xfb\x02\x20SymbolRole\x20declares\x20what\x20\ + \"role\"\x20a\x20symbol\x20has\x20in\x20an\x20occurrence.\x20\x20A\x20ro\ + le\x20is\n\x20encoded\x20as\x20a\x20bitmask\x20where\x20each\x20bit\x20r\ + epresents\x20a\x20different\x20role.\x20For\x20example,\n\x20to\x20deter\ + mine\x20if\x20the\x20`Import`\x20role\x20is\x20set\x20test\x20whether\ + \x20the\x20second\x20bit\x20of\x20the\n\x20enum\x20value\x20is\x20define\ + d.\x20In\x20psuedo-code,\x20this\x20can\x20be\x20implemented\x20with\x20\ + the\n\x20logic:\x20`const\x20isImportRole\x20=\x20(role.value\x20&\x20Sy\ + mbolRole.Import.value)\x20>\x200`.\n\n\x0b\n\x03\x05\x02\x01\x12\x04\xc7\ + \x01\x05\x0f\n\x0c\n\x04\x05\x02\x02\0\x12\x04\xc8\x01\x02\x1c\n\r\n\x05\ + \x05\x02\x02\0\x01\x12\x04\xc8\x01\x02\x17\n\r\n\x05\x05\x02\x02\0\x02\ + \x12\x04\xc8\x01\x1a\x1b\nT\n\x04\x05\x02\x02\x01\x12\x04\xca\x01\x02\ + \x13\x1aF\x20Is\x20the\x20symbol\x20defined\x20here?\x20If\x20not,\x20th\ + en\x20this\x20is\x20a\x20symbol\x20reference.\n\n\r\n\x05\x05\x02\x02\ + \x01\x01\x12\x04\xca\x01\x02\x0c\n\r\n\x05\x05\x02\x02\x01\x02\x12\x04\ + \xca\x01\x0f\x12\n,\n\x04\x05\x02\x02\x02\x12\x04\xcc\x01\x02\x0f\x1a\ + \x1e\x20Is\x20the\x20symbol\x20imported\x20here?\n\n\r\n\x05\x05\x02\x02\ + \x02\x01\x12\x04\xcc\x01\x02\x08\n\r\n\x05\x05\x02\x02\x02\x02\x12\x04\ + \xcc\x01\x0b\x0e\n+\n\x04\x05\x02\x02\x03\x12\x04\xce\x01\x02\x14\x1a\ + \x1d\x20Is\x20the\x20symbol\x20written\x20here?\n\n\r\n\x05\x05\x02\x02\ + \x03\x01\x12\x04\xce\x01\x02\r\n\r\n\x05\x05\x02\x02\x03\x02\x12\x04\xce\ + \x01\x10\x13\n(\n\x04\x05\x02\x02\x04\x12\x04\xd0\x01\x02\x13\x1a\x1a\ + \x20Is\x20the\x20symbol\x20read\x20here?\n\n\r\n\x05\x05\x02\x02\x04\x01\ + \x12\x04\xd0\x01\x02\x0c\n\r\n\x05\x05\x02\x02\x04\x02\x12\x04\xd0\x01\ + \x0f\x12\n0\n\x04\x05\x02\x02\x05\x12\x04\xd2\x01\x02\x13\x1a\"\x20Is\ + \x20the\x20symbol\x20in\x20generated\x20code?\n\n\r\n\x05\x05\x02\x02\ + \x05\x01\x12\x04\xd2\x01\x02\x0b\n\r\n\x05\x05\x02\x02\x05\x02\x12\x04\ + \xd2\x01\x0e\x12\n+\n\x04\x05\x02\x02\x06\x12\x04\xd4\x01\x02\x0e\x1a\ + \x1d\x20Is\x20the\x20symbol\x20in\x20test\x20code?\n\n\r\n\x05\x05\x02\ + \x02\x06\x01\x12\x04\xd4\x01\x02\x06\n\r\n\x05\x05\x02\x02\x06\x02\x12\ + \x04\xd4\x01\t\r\n\x0c\n\x02\x05\x03\x12\x06\xd7\x01\0\xad\x02\x01\n\x0b\ + \n\x03\x05\x03\x01\x12\x04\xd7\x01\x05\x0f\n\x0c\n\x04\x05\x03\x02\0\x12\ + \x04\xd8\x01\x02\x1c\n\r\n\x05\x05\x03\x02\0\x01\x12\x04\xd8\x01\x02\x17\ + \n\r\n\x05\x05\x03\x02\0\x02\x12\x04\xd8\x01\x1a\x1b\n;\n\x04\x05\x03\ + \x02\x01\x12\x04\xdb\x01\x02\x0e\x1a-\x20Comment,\x20including\x20commen\ + t\x20markers\x20and\x20text\n\n\r\n\x05\x05\x03\x02\x01\x01\x12\x04\xdb\ + \x01\x02\t\n\r\n\x05\x05\x03\x02\x01\x02\x12\x04\xdb\x01\x0c\r\n\x1b\n\ + \x04\x05\x03\x02\x02\x12\x04\xde\x01\x02\x1b\x1a\r\x20`;`\x20`.`\x20`,`\ + \n\n\r\n\x05\x05\x03\x02\x02\x01\x12\x04\xde\x01\x02\x16\n\r\n\x05\x05\ + \x03\x02\x02\x02\x12\x04\xde\x01\x19\x1a\n2\n\x04\x05\x03\x02\x03\x12\ + \x04\xe0\x01\x02\x19\x1a$\x20(),\x20{},\x20[]\x20when\x20used\x20syntact\ + ically\n\n\r\n\x05\x05\x03\x02\x03\x01\x12\x04\xe0\x01\x02\x14\n\r\n\x05\ + \x05\x03\x02\x03\x02\x12\x04\xe0\x01\x17\x18\n5\n\x04\x05\x03\x02\x04\ + \x12\x04\xe3\x01\x02\x18\x1a'\x20`if`,\x20`else`,\x20`return`,\x20`class\ + `,\x20etc.\n\n\r\n\x05\x05\x03\x02\x04\x01\x12\x04\xe3\x01\x02\x13\n\r\n\ + \x05\x05\x03\x02\x04\x02\x12\x04\xe3\x01\x16\x17\n\x1e\n\x04\x05\x03\x02\ + \x05\x12\x04\xe6\x01\x02\x19\x1a\x10\x20`+`,\x20`*`,\x20etc.\n\n\r\n\x05\ + \x05\x03\x02\x05\x01\x12\x04\xe6\x01\x02\x14\n\r\n\x05\x05\x03\x02\x05\ + \x02\x12\x04\xe6\x01\x17\x18\nX\n\x04\x05\x03\x02\x06\x12\x04\xe9\x01\ + \x02\x11\x1aJ\x20non-specific\x20catch-all\x20for\x20any\x20identifier\ + \x20not\x20better\x20described\x20elsewhere\n\n\r\n\x05\x05\x03\x02\x06\ + \x01\x12\x04\xe9\x01\x02\x0c\n\r\n\x05\x05\x03\x02\x06\x02\x12\x04\xe9\ + \x01\x0f\x10\nN\n\x04\x05\x03\x02\x07\x12\x04\xeb\x01\x02\x18\x1a@\x20Id\ + entifiers\x20builtin\x20to\x20the\x20language:\x20`min`,\x20`print`\x20i\ + n\x20Python.\n\n\r\n\x05\x05\x03\x02\x07\x01\x12\x04\xeb\x01\x02\x13\n\r\ + \n\x05\x05\x03\x02\x07\x02\x12\x04\xeb\x01\x16\x17\n[\n\x04\x05\x03\x02\ + \x08\x12\x04\xed\x01\x02\x15\x1aM\x20Identifiers\x20representing\x20`nul\ + l`-like\x20values:\x20`None`\x20in\x20Python,\x20`nil`\x20in\x20Go.\n\n\ + \r\n\x05\x05\x03\x02\x08\x01\x12\x04\xed\x01\x02\x10\n\r\n\x05\x05\x03\ + \x02\x08\x02\x12\x04\xed\x01\x13\x14\n.\n\x04\x05\x03\x02\t\x12\x04\xef\ + \x01\x02\x19\x1a\x20\x20`xyz`\x20in\x20`const\x20xyz\x20=\x20\"hello\"`\ + \n\n\r\n\x05\x05\x03\x02\t\x01\x12\x04\xef\x01\x02\x14\n\r\n\x05\x05\x03\ + \x02\t\x02\x12\x04\xef\x01\x17\x18\n'\n\x04\x05\x03\x02\n\x12\x04\xf1\ + \x01\x02\x1f\x1a\x19\x20`var\x20X\x20=\x20\"hello\"`\x20in\x20Go\n\n\r\n\ + \x05\x05\x03\x02\n\x01\x12\x04\xf1\x01\x02\x19\n\r\n\x05\x05\x03\x02\n\ + \x02\x12\x04\xf1\x01\x1c\x1e\n8\n\x04\x05\x03\x02\x0b\x12\x04\xf3\x01\ + \x02\x1b\x1a*\x20both\x20parameter\x20definition\x20and\x20references\n\ + \n\r\n\x05\x05\x03\x02\x0b\x01\x12\x04\xf3\x01\x02\x15\n\r\n\x05\x05\x03\ + \x02\x0b\x02\x12\x04\xf3\x01\x18\x1a\nX\n\x04\x05\x03\x02\x0c\x12\x04\ + \xf5\x01\x02\x17\x1aJ\x20identifiers\x20for\x20variable\x20definitions\ + \x20and\x20references\x20within\x20a\x20local\x20scope\n\n\r\n\x05\x05\ + \x03\x02\x0c\x01\x12\x04\xf5\x01\x02\x11\n\r\n\x05\x05\x03\x02\x0c\x02\ + \x12\x04\xf5\x01\x14\x16\nT\n\x04\x05\x03\x02\r\x12\x04\xf7\x01\x02\x1a\ + \x1aF\x20Used\x20when\x20identifier\x20shadowes\x20some\x20other\x20iden\ + tifier\x20within\x20the\x20scope\n\n\r\n\x05\x05\x03\x02\r\x01\x12\x04\ + \xf7\x01\x02\x14\n\r\n\x05\x05\x03\x02\r\x02\x12\x04\xf7\x01\x17\x19\n\ + \x1e\n\x04\x05\x03\x02\x0e\x12\x04\xf9\x01\x02\x18\x1a\x10\x20`package\ + \x20main`\n\n\r\n\x05\x05\x03\x02\x0e\x01\x12\x04\xf9\x01\x02\x12\n\r\n\ + \x05\x05\x03\x02\x0e\x02\x12\x04\xf9\x01\x15\x17\n'\n\x04\x05\x03\x02\ + \x0f\x12\x04\xfc\x01\x02\x1a\x1a\x19\x20Function\x20call/reference\n\n\r\ + \n\x05\x05\x03\x02\x0f\x01\x12\x04\xfc\x01\x02\x14\n\r\n\x05\x05\x03\x02\ + \x0f\x02\x12\x04\xfc\x01\x17\x19\n(\n\x04\x05\x03\x02\x10\x12\x04\xfe\ + \x01\x02$\x1a\x1a\x20Function\x20definition\x20only\n\n\r\n\x05\x05\x03\ + \x02\x10\x01\x12\x04\xfe\x01\x02\x1e\n\r\n\x05\x05\x03\x02\x10\x02\x12\ + \x04\xfe\x01!#\n$\n\x04\x05\x03\x02\x11\x12\x04\x81\x02\x02\x17\x1a\x16\ + \x20Macro\x20call/reference\n\n\r\n\x05\x05\x03\x02\x11\x01\x12\x04\x81\ + \x02\x02\x11\n\r\n\x05\x05\x03\x02\x11\x02\x12\x04\x81\x02\x14\x16\n%\n\ + \x04\x05\x03\x02\x12\x12\x04\x83\x02\x02!\x1a\x17\x20Macro\x20definition\ + \x20only\n\n\r\n\x05\x05\x03\x02\x12\x01\x12\x04\x83\x02\x02\x1b\n\r\n\ + \x05\x05\x03\x02\x12\x02\x12\x04\x83\x02\x1e\x20\n7\n\x04\x05\x03\x02\ + \x13\x12\x04\x86\x02\x02\x16\x1a)\x20non-builtin\x20types,\x20including\ + \x20namespaces\n\n\r\n\x05\x05\x03\x02\x13\x01\x12\x04\x86\x02\x02\x10\n\ + \r\n\x05\x05\x03\x02\x13\x02\x12\x04\x86\x02\x13\x15\nK\n\x04\x05\x03\ + \x02\x14\x12\x04\x88\x02\x02\x1d\x1a=\x20builtin\x20types\x20only,\x20su\ + ch\x20as\x20`str`\x20for\x20Python\x20or\x20`int`\x20in\x20Go\n\n\r\n\ + \x05\x05\x03\x02\x14\x01\x12\x04\x88\x02\x02\x17\n\r\n\x05\x05\x03\x02\ + \x14\x02\x12\x04\x88\x02\x1a\x1c\n7\n\x04\x05\x03\x02\x15\x12\x04\x8b\ + \x02\x02\x1b\x1a)\x20Python\x20decorators,\x20c-like\x20__attribute__\n\ + \n\r\n\x05\x05\x03\x02\x15\x01\x12\x04\x8b\x02\x02\x15\n\r\n\x05\x05\x03\ + \x02\x15\x02\x12\x04\x8b\x02\x18\x1a\n\x14\n\x04\x05\x03\x02\x16\x12\x04\ + \x8e\x02\x02\x13\x1a\x06\x20`\\b`\n\n\r\n\x05\x05\x03\x02\x16\x01\x12\ + \x04\x8e\x02\x02\r\n\r\n\x05\x05\x03\x02\x16\x02\x12\x04\x8e\x02\x10\x12\ + \n\x18\n\x04\x05\x03\x02\x17\x12\x04\x90\x02\x02\x15\x1a\n\x20`*`,\x20`+\ + `\n\n\r\n\x05\x05\x03\x02\x17\x01\x12\x04\x90\x02\x02\x0f\n\r\n\x05\x05\ + \x03\x02\x17\x02\x12\x04\x90\x02\x12\x14\n\x13\n\x04\x05\x03\x02\x18\x12\ + \x04\x92\x02\x02\x15\x1a\x05\x20`.`\n\n\r\n\x05\x05\x03\x02\x18\x01\x12\ + \x04\x92\x02\x02\x0f\n\r\n\x05\x05\x03\x02\x18\x02\x12\x04\x92\x02\x12\ + \x14\n\"\n\x04\x05\x03\x02\x19\x12\x04\x94\x02\x02\x16\x1a\x14\x20`(`,\ + \x20`)`,\x20`[`,\x20`]`\n\n\r\n\x05\x05\x03\x02\x19\x01\x12\x04\x94\x02\ + \x02\x10\n\r\n\x05\x05\x03\x02\x19\x02\x12\x04\x94\x02\x13\x15\n\x18\n\ + \x04\x05\x03\x02\x1a\x12\x04\x96\x02\x02\x11\x1a\n\x20`|`,\x20`-`\n\n\r\ + \n\x05\x05\x03\x02\x1a\x01\x12\x04\x96\x02\x02\x0b\n\r\n\x05\x05\x03\x02\ + \x1a\x02\x12\x04\x96\x02\x0e\x10\n0\n\x04\x05\x03\x02\x1b\x12\x04\x99\ + \x02\x02\x15\x1a\"\x20Literal\x20strings:\x20\"Hello,\x20world!\"\n\n\r\ + \n\x05\x05\x03\x02\x1b\x01\x12\x04\x99\x02\x02\x0f\n\r\n\x05\x05\x03\x02\ + \x1b\x02\x12\x04\x99\x02\x12\x14\n-\n\x04\x05\x03\x02\x1c\x12\x04\x9b\ + \x02\x02\x1b\x1a\x1f\x20non-regex\x20escapes:\x20\"\\t\",\x20\"\\n\"\n\n\ + \r\n\x05\x05\x03\x02\x1c\x01\x12\x04\x9b\x02\x02\x15\n\r\n\x05\x05\x03\ + \x02\x1c\x02\x12\x04\x9b\x02\x18\x1a\n_\n\x04\x05\x03\x02\x1d\x12\x04\ + \x9d\x02\x02\x1c\x1aQ\x20datetimes\x20within\x20strings,\x20special\x20w\ + ords\x20within\x20a\x20string,\x20`{}`\x20in\x20format\x20strings\n\n\r\ + \n\x05\x05\x03\x02\x1d\x01\x12\x04\x9d\x02\x02\x16\n\r\n\x05\x05\x03\x02\ + \x1d\x02\x12\x04\x9d\x02\x19\x1b\nG\n\x04\x05\x03\x02\x1e\x12\x04\x9f\ + \x02\x02\x18\x1a9\x20\"key\"\x20in\x20{\x20\"key\":\x20\"value\"\x20},\ + \x20useful\x20for\x20example\x20in\x20JSON\n\n\r\n\x05\x05\x03\x02\x1e\ + \x01\x12\x04\x9f\x02\x02\x12\n\r\n\x05\x05\x03\x02\x1e\x02\x12\x04\x9f\ + \x02\x15\x17\nV\n\x04\x05\x03\x02\x1f\x12\x04\xa1\x02\x02\x18\x1aH\x20'c\ + '\x20or\x20similar,\x20in\x20languages\x20that\x20differentiate\x20strin\ + gs\x20and\x20characters\n\n\r\n\x05\x05\x03\x02\x1f\x01\x12\x04\xa1\x02\ + \x02\x12\n\r\n\x05\x05\x03\x02\x1f\x02\x12\x04\xa1\x02\x15\x17\n9\n\x04\ + \x05\x03\x02\x20\x12\x04\xa3\x02\x02\x16\x1a+\x20Literal\x20numbers,\x20\ + both\x20floats\x20and\x20integers\n\n\r\n\x05\x05\x03\x02\x20\x01\x12\ + \x04\xa3\x02\x02\x10\n\r\n\x05\x05\x03\x02\x20\x02\x12\x04\xa3\x02\x13\ + \x15\n\x1f\n\x04\x05\x03\x02!\x12\x04\xa5\x02\x02\x16\x1a\x11\x20`true`,\ + \x20`false`\n\n\r\n\x05\x05\x03\x02!\x01\x12\x04\xa5\x02\x02\x10\n\r\n\ + \x05\x05\x03\x02!\x02\x12\x04\xa5\x02\x13\x15\n&\n\x04\x05\x03\x02\"\x12\ + \x04\xa8\x02\x02\x0b\x1a\x18\x20Used\x20for\x20XML-like\x20tags\n\n\r\n\ + \x05\x05\x03\x02\"\x01\x12\x04\xa8\x02\x02\x05\n\r\n\x05\x05\x03\x02\"\ + \x02\x12\x04\xa8\x02\x08\n\n/\n\x04\x05\x03\x02#\x12\x04\xaa\x02\x02\x14\ + \x1a!\x20Attribute\x20name\x20in\x20XML-like\x20tags\n\n\r\n\x05\x05\x03\ + \x02#\x01\x12\x04\xaa\x02\x02\x0e\n\r\n\x05\x05\x03\x02#\x02\x12\x04\xaa\ + \x02\x11\x13\n,\n\x04\x05\x03\x02$\x12\x04\xac\x02\x02\x14\x1a\x1e\x20De\ + limiters\x20for\x20XML-like\x20tags\n\n\r\n\x05\x05\x03\x02$\x01\x12\x04\ + \xac\x02\x02\x0e\n\r\n\x05\x05\x03\x02$\x02\x12\x04\xac\x02\x11\x13\ng\n\ + \x02\x04\t\x12\x06\xb1\x02\0\xd5\x02\x01\x1aY\x20Occurrence\x20associate\ + s\x20a\x20source\x20position\x20with\x20a\x20symbol\x20and/or\x20highlig\ + hting\n\x20information.\n\n\x0b\n\x03\x04\t\x01\x12\x04\xb1\x02\x08\x12\ + \n\xc7\x07\n\x04\x04\t\x02\0\x12\x04\xc4\x02\x02\x1b\x1a\xb8\x07\x20Sour\ + ce\x20position\x20of\x20this\x20occurrence.\x20Must\x20be\x20exactly\x20\ + three\x20or\x20four\n\x20elements:\n\n\x20-\x20Four\x20elements:\x20`[st\ + artLine,\x20startCharacter,\x20endLine,\x20endCharacter]`\n\x20-\x20Thre\ + e\x20elements:\x20`[startLine,\x20startCharacter,\x20endCharacter]`.\x20\ + The\x20end\x20line\n\x20\x20\x20is\x20inferred\x20to\x20have\x20the\x20s\ + ame\x20value\x20as\x20the\x20start\x20line.\n\n\x20Line\x20numbers\x20an\ + d\x20characters\x20are\x20always\x200-based.\x20Make\x20sure\x20to\x20in\ + crement\x20the\n\x20line/character\x20values\x20before\x20displaying\x20\ + them\x20in\x20an\x20editor-like\x20UI\x20because\n\x20editors\x20convent\ + ionally\x20use\x201-based\x20numbers.\n\n\x20Historical\x20note:\x20the\ + \x20original\x20draft\x20of\x20this\x20schema\x20had\x20a\x20`Range`\x20\ + message\n\x20type\x20with\x20`start`\x20and\x20`end`\x20fields\x20of\x20\ + type\x20`Position`,\x20mirroring\x20LSP.\n\x20Benchmarks\x20revealed\x20\ + that\x20this\x20encoding\x20was\x20inefficient\x20and\x20that\x20we\x20c\ + ould\n\x20reduce\x20the\x20total\x20payload\x20size\x20of\x20an\x20index\ + \x20by\x2050%\x20by\x20using\x20`repeated\x20int32`\n\x20instead.\x20\ + \x20The\x20`repeated\x20int32`\x20encoding\x20is\x20admittedly\x20more\ + \x20embarrassing\x20to\n\x20work\x20with\x20in\x20some\x20programming\ + \x20languages\x20but\x20we\x20hope\x20the\x20performance\n\x20improvemen\ + ts\x20make\x20up\x20for\x20it.\n\n\r\n\x05\x04\t\x02\0\x04\x12\x04\xc4\ + \x02\x02\n\n\r\n\x05\x04\t\x02\0\x05\x12\x04\xc4\x02\x0b\x10\n\r\n\x05\ + \x04\t\x02\0\x01\x12\x04\xc4\x02\x11\x16\n\r\n\x05\x04\t\x02\0\x03\x12\ + \x04\xc4\x02\x19\x1a\n\x8a\x01\n\x04\x04\t\x02\x01\x12\x04\xc7\x02\x02\ + \x14\x1a|\x20(optional)\x20The\x20symbol\x20that\x20appears\x20at\x20thi\ + s\x20position.\x20See\n\x20`SymbolInformation.symbol`\x20for\x20how\x20t\ + o\x20format\x20symbols\x20as\x20strings.\n\n\r\n\x05\x04\t\x02\x01\x05\ + \x12\x04\xc7\x02\x02\x08\n\r\n\x05\x04\t\x02\x01\x01\x12\x04\xc7\x02\t\ + \x0f\n\r\n\x05\x04\t\x02\x01\x03\x12\x04\xc7\x02\x12\x13\n\x8a\x01\n\x04\ + \x04\t\x02\x02\x12\x04\xca\x02\x02\x19\x1a|\x20(optional)\x20Bitmask\x20\ + for\x20what\x20`SymbolRole`\x20apply\x20to\x20this\x20occurrence.\x20See\ + \n\x20`SymbolRole`\x20for\x20how\x20to\x20read\x20and\x20write\x20this\ + \x20field.\n\n\r\n\x05\x04\t\x02\x02\x05\x12\x04\xca\x02\x02\x07\n\r\n\ + \x05\x04\t\x02\x02\x01\x12\x04\xca\x02\x08\x14\n\r\n\x05\x04\t\x02\x02\ + \x03\x12\x04\xca\x02\x17\x18\n\xf0\x02\n\x04\x04\t\x02\x03\x12\x04\xd0\ + \x02\x02-\x1a\xe1\x02\x20(optional)\x20Markdown-formatted\x20documentati\ + on\x20for\x20this\x20specific\x20range.\x20\x20If\n\x20empty,\x20the\x20\ + `Symbol.documentation`\x20field\x20is\x20used\x20instead.\x20One\x20exam\ + ple\n\x20where\x20this\x20field\x20might\x20be\x20useful\x20is\x20when\ + \x20the\x20symbol\x20represents\x20a\x20generic\n\x20function\x20(with\ + \x20abstract\x20type\x20parameters\x20such\x20as\x20`List`)\x20and\ + \x20at\x20this\n\x20occurrence\x20we\x20know\x20the\x20exact\x20values\ + \x20(such\x20as\x20`List`).\n\n\r\n\x05\x04\t\x02\x03\x04\x12\ + \x04\xd0\x02\x02\n\n\r\n\x05\x04\t\x02\x03\x05\x12\x04\xd0\x02\x0b\x11\n\ + \r\n\x05\x04\t\x02\x03\x01\x12\x04\xd0\x02\x12(\n\r\n\x05\x04\t\x02\x03\ + \x03\x12\x04\xd0\x02+,\nX\n\x04\x04\t\x02\x04\x12\x04\xd2\x02\x02\x1d\ + \x1aJ\x20(optional)\x20What\x20syntax\x20highlighting\x20class\x20should\ + \x20be\x20used\x20for\x20this\x20range?\n\n\r\n\x05\x04\t\x02\x04\x06\ + \x12\x04\xd2\x02\x02\x0c\n\r\n\x05\x04\t\x02\x04\x01\x12\x04\xd2\x02\r\ + \x18\n\r\n\x05\x04\t\x02\x04\x03\x12\x04\xd2\x02\x1b\x1c\nL\n\x04\x04\t\ + \x02\x05\x12\x04\xd4\x02\x02&\x1a>\x20Diagnostics\x20that\x20have\x20bee\ + n\x20reported\x20for\x20this\x20specific\x20range.\n\n\r\n\x05\x04\t\x02\ + \x05\x04\x12\x04\xd4\x02\x02\n\n\r\n\x05\x04\t\x02\x05\x06\x12\x04\xd4\ + \x02\x0b\x15\n\r\n\x05\x04\t\x02\x05\x01\x12\x04\xd4\x02\x16!\n\r\n\x05\ + \x04\t\x02\x05\x03\x12\x04\xd4\x02$%\nw\n\x02\x04\n\x12\x06\xd9\x02\0\ + \xe4\x02\x01\x1ai\x20Represents\x20a\x20diagnostic,\x20such\x20as\x20a\ + \x20compiler\x20error\x20or\x20warning,\x20which\x20should\x20be\n\x20re\ + ported\x20for\x20a\x20document.\n\n\x0b\n\x03\x04\n\x01\x12\x04\xd9\x02\ + \x08\x12\nW\n\x04\x04\n\x02\0\x12\x04\xdb\x02\x02\x18\x1aI\x20Should\x20\ + this\x20diagnostic\x20be\x20reported\x20as\x20an\x20error,\x20warning,\ + \x20info,\x20or\x20hint?\n\n\r\n\x05\x04\n\x02\0\x06\x12\x04\xdb\x02\x02\ + \n\n\r\n\x05\x04\n\x02\0\x01\x12\x04\xdb\x02\x0b\x13\n\r\n\x05\x04\n\x02\ + \0\x03\x12\x04\xdb\x02\x16\x17\nR\n\x04\x04\n\x02\x01\x12\x04\xdd\x02\ + \x02\x12\x1aD\x20Code\x20of\x20this\x20diagnostic,\x20which\x20might\x20\ + appear\x20in\x20the\x20user\x20interface.\n\n\r\n\x05\x04\n\x02\x01\x05\ + \x12\x04\xdd\x02\x02\x08\n\r\n\x05\x04\n\x02\x01\x01\x12\x04\xdd\x02\t\r\ + \n\r\n\x05\x04\n\x02\x01\x03\x12\x04\xdd\x02\x10\x11\n+\n\x04\x04\n\x02\ + \x02\x12\x04\xdf\x02\x02\x15\x1a\x1d\x20Message\x20of\x20this\x20diagnos\ + tic.\n\n\r\n\x05\x04\n\x02\x02\x05\x12\x04\xdf\x02\x02\x08\n\r\n\x05\x04\ + \n\x02\x02\x01\x12\x04\xdf\x02\t\x10\n\r\n\x05\x04\n\x02\x02\x03\x12\x04\ + \xdf\x02\x13\x14\ns\n\x04\x04\n\x02\x03\x12\x04\xe2\x02\x02\x14\x1ae\x20\ + Human-readable\x20string\x20describing\x20the\x20source\x20of\x20this\ + \x20diagnostic,\x20e.g.\n\x20'typescript'\x20or\x20'super\x20lint'.\n\n\ + \r\n\x05\x04\n\x02\x03\x05\x12\x04\xe2\x02\x02\x08\n\r\n\x05\x04\n\x02\ + \x03\x01\x12\x04\xe2\x02\t\x0f\n\r\n\x05\x04\n\x02\x03\x03\x12\x04\xe2\ + \x02\x12\x13\n\x0c\n\x04\x04\n\x02\x04\x12\x04\xe3\x02\x02\"\n\r\n\x05\ + \x04\n\x02\x04\x04\x12\x04\xe3\x02\x02\n\n\r\n\x05\x04\n\x02\x04\x06\x12\ + \x04\xe3\x02\x0b\x18\n\r\n\x05\x04\n\x02\x04\x01\x12\x04\xe3\x02\x19\x1d\ + \n\r\n\x05\x04\n\x02\x04\x03\x12\x04\xe3\x02\x20!\n\x0c\n\x02\x05\x04\ + \x12\x06\xe6\x02\0\xec\x02\x01\n\x0b\n\x03\x05\x04\x01\x12\x04\xe6\x02\ + \x05\r\n\x0c\n\x04\x05\x04\x02\0\x12\x04\xe7\x02\x04\x1c\n\r\n\x05\x05\ + \x04\x02\0\x01\x12\x04\xe7\x02\x04\x17\n\r\n\x05\x05\x04\x02\0\x02\x12\ + \x04\xe7\x02\x1a\x1b\n\x0c\n\x04\x05\x04\x02\x01\x12\x04\xe8\x02\x04\x0e\ + \n\r\n\x05\x05\x04\x02\x01\x01\x12\x04\xe8\x02\x04\t\n\r\n\x05\x05\x04\ + \x02\x01\x02\x12\x04\xe8\x02\x0c\r\n\x0c\n\x04\x05\x04\x02\x02\x12\x04\ + \xe9\x02\x04\x10\n\r\n\x05\x05\x04\x02\x02\x01\x12\x04\xe9\x02\x04\x0b\n\ + \r\n\x05\x05\x04\x02\x02\x02\x12\x04\xe9\x02\x0e\x0f\n\x0c\n\x04\x05\x04\ + \x02\x03\x12\x04\xea\x02\x04\x14\n\r\n\x05\x05\x04\x02\x03\x01\x12\x04\ + \xea\x02\x04\x0f\n\r\n\x05\x05\x04\x02\x03\x02\x12\x04\xea\x02\x12\x13\n\ + \x0c\n\x04\x05\x04\x02\x04\x12\x04\xeb\x02\x04\r\n\r\n\x05\x05\x04\x02\ + \x04\x01\x12\x04\xeb\x02\x04\x08\n\r\n\x05\x05\x04\x02\x04\x02\x12\x04\ + \xeb\x02\x0b\x0c\n\x0c\n\x02\x05\x05\x12\x06\xee\x02\0\xf2\x02\x01\n\x0b\ + \n\x03\x05\x05\x01\x12\x04\xee\x02\x05\x12\n\x0c\n\x04\x05\x05\x02\0\x12\ + \x04\xef\x02\x04!\n\r\n\x05\x05\x05\x02\0\x01\x12\x04\xef\x02\x04\x1c\n\ + \r\n\x05\x05\x05\x02\0\x02\x12\x04\xef\x02\x1f\x20\n\x0c\n\x04\x05\x05\ + \x02\x01\x12\x04\xf0\x02\x04\x14\n\r\n\x05\x05\x05\x02\x01\x01\x12\x04\ + \xf0\x02\x04\x0f\n\r\n\x05\x05\x05\x02\x01\x02\x12\x04\xf0\x02\x12\x13\n\ + \x0c\n\x04\x05\x05\x02\x02\x12\x04\xf1\x02\x04\x13\n\r\n\x05\x05\x05\x02\ + \x02\x01\x12\x04\xf1\x02\x04\x0e\n\r\n\x05\x05\x05\x02\x02\x02\x12\x04\ + \xf1\x02\x11\x12b\x06proto3\ +"; + +static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) +} diff --git a/docker-images/syntax-highlighter/crates/sg-macros/Cargo.toml b/docker-images/syntax-highlighter/crates/sg-macros/Cargo.toml new file mode 100644 index 000000000000..76becb5d2fdd --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-macros/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "sg-macros" +version = "0.1.0" +edition = "2021" +autotests = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +proc-macro = true + +[dependencies] +quote = "1" +syn = "1" + +[dev-dependencies] +pretty_assertions = "1" diff --git a/docker-images/syntax-highlighter/crates/sg-macros/src/lib.rs b/docker-images/syntax-highlighter/crates/sg-macros/src/lib.rs new file mode 100644 index 000000000000..4207cb4c4c98 --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-macros/src/lib.rs @@ -0,0 +1,63 @@ +use std::path::PathBuf; + +use proc_macro::TokenStream; +use quote::quote; +use syn::{ + parse::{Parse, ParseStream}, + parse_macro_input, + token::Comma, + Ident, LitStr, +}; + +struct IncludeOptional { + literals: Vec, +} + +impl Parse for IncludeOptional { + fn parse(input: ParseStream) -> syn::Result { + let mut literals = Vec::new(); + + // parse while we still have inputs. + loop { + if input.peek(LitStr) { + let lit_str: LitStr = input.parse()?; + literals.push(lit_str.value()); + } else if input.peek(Ident) { + let ident: Ident = input.parse()?; + literals.push(ident.to_string()); + } else { + panic!("Should make error here but it's OK for now"); + } + + if input.is_empty() { + break; + } + + let _: Comma = input.parse()?; + if input.is_empty() { + break; + } + } + + Ok(Self { literals }) + } +} + +#[proc_macro] +pub fn include_project_file_optional(input: TokenStream) -> TokenStream { + let literals = parse_macro_input!(input as IncludeOptional).literals; + + // project files are always relative to the Cargo.toml of the compiling project. + let base = std::env::var("CARGO_MANIFEST_DIR").unwrap().to_owned() + "/"; + let filepath: PathBuf = literals.iter().fold(base, |acc, lit| acc + &lit).into(); + + if filepath.exists() { + let filepath = filepath + .to_str() + .expect("Filepath must be expandable at this point"); + + quote! { include_str!(#filepath) }.into() + } else { + quote! { "" }.into() + } +} diff --git a/docker-images/syntax-highlighter/crates/sg-macros/tests/include_optional.rs b/docker-images/syntax-highlighter/crates/sg-macros/tests/include_optional.rs new file mode 100644 index 000000000000..f0ff7b2177fd --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-macros/tests/include_optional.rs @@ -0,0 +1,40 @@ +use pretty_assertions::assert_eq; +use sg_macros::include_project_file_optional; + +#[test] +fn can_get_literal_file() { + assert_eq!( + include_str!("../src/lib.rs"), + include_project_file_optional!("src/lib.rs") + ); +} + +#[test] +fn can_get_literal_file_with_multiple_vals() { + assert_eq!( + include_str!("../src/lib.rs"), + include_project_file_optional!("src/", "lib.rs") + ); +} + +#[test] +fn returns_empty_string_if_file_doesnt_exist() { + assert_eq!( + "", + include_project_file_optional!("/this/file/does/not/exist") + ); +} + +macro_rules! example { + ($name: tt) => { + include_project_file_optional!("src/", $name, ".rs") + }; +} + +#[test] +fn can_handle_literal_macro() { + assert_eq!( + include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/lib.rs")), + example!(lib) + ); +} diff --git a/docker-images/syntax-highlighter/crates/sg-syntax/Cargo.toml b/docker-images/syntax-highlighter/crates/sg-syntax/Cargo.toml new file mode 100644 index 000000000000..486355c2203e --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-syntax/Cargo.toml @@ -0,0 +1,34 @@ +[package] +name = "sg-syntax" +version = "0.1.0" +authors = ["TJ DeVries "] +edition = "2021" +license = "MIT" +include = ["src/**/*", "languages/**/*", "queries/**/*", "build.rs"] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +syntect = { git = "https://github.com/slimsag/syntect" } +rocket = { git = "https://github.com/SergioBenitez/Rocket", features = ["json"] } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +lazy_static = "1.0" +tree-sitter = "0.20.3" +tree-sitter-highlight = ">=0.19, <0.22" +protobuf = "2.25.2" +base64 = "0.13.0" +anyhow = "1" +libloading = "0.7" +paste = "1.0.6" +sg-macros = { path = "../sg-macros" } +sg-lsif = { path = "../sg-lsif" } + +[dev-dependencies] +insta = "1.11.0" + +[build-dependencies] +cc = { version = "1" } +anyhow = "1" + +[features] diff --git a/docker-images/syntax-highlighter/crates/sg-syntax/build.rs b/docker-images/syntax-highlighter/crates/sg-syntax/build.rs new file mode 100644 index 000000000000..6e429ccbaf76 --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-syntax/build.rs @@ -0,0 +1,117 @@ +use anyhow::Result; +use std::fs; +use std::path::{Path, PathBuf}; + +fn collect_tree_sitter_dirs(ignore: &[String]) -> Result> { + let mut dirs = Vec::new(); + let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("languages"); + + for entry in fs::read_dir(path)? { + let entry = entry?; + let path = entry.path(); + + if !entry.file_type()?.is_dir() { + continue; + } + + let dir = path.file_name().unwrap().to_str().unwrap().to_string(); + + // filter ignores + if ignore.contains(&dir) { + continue; + } + dirs.push(dir) + } + + Ok(dirs) +} + +fn scanner_file(src_path: &Path) -> Option { + let mut scanner_path = src_path.join("scanner.c"); + + if scanner_path.exists() { + Some(scanner_path) + } else { + // TODO: This may be a problem if someone uses c++ here?... :'( + // If I am unfortunately cursed with having to build a C++ thing, as defined by Cargo Book + scanner_path.set_extension("cc"); + if scanner_path.exists() { + Some(scanner_path) + } else { + None + } + } +} + +fn build_library(src_path: &Path, language: &str) -> Result<()> { + let header_path = src_path; + let parser_path = src_path.join("parser.c"); + let scanner_path = scanner_file(src_path); + + println!("cargo:rerun-if-changed={}", parser_path.display()); + if let Some(scanner) = &scanner_path { + println!("cargo:rerun-if-changed={}", scanner.display()); + } + + let mut config = cc::Build::new(); + config.opt_level(2); + config.debug(false); + config.warnings(false); + config.shared_flag(false); + + config.include(header_path); + + config.file(parser_path); + if let Some(scanner) = &scanner_path { + config.file(scanner); + } + + config.compile(language); + + Ok(()) +} + +fn build_dir(dir: &str, language: &str) { + println!("Build language {}", language); + if PathBuf::from("languages") + .join(dir) + .read_dir() + .unwrap() + .next() + .is_none() + { + eprintln!( + "The directory {} is empty, you probably need to use 'git submodule update --init --recursive'?", + dir + ); + std::process::exit(1); + } + + let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .join("languages") + .join(dir) + .join("src"); + + build_library(&path, language).unwrap(); +} + +fn main() { + let ignore = vec![ + "tree-sitter-typescript".to_string(), + "tree-sitter-ocaml".to_string(), + ]; + + let dirs = collect_tree_sitter_dirs(&ignore).expect("to have found found the tree-sitter dirs"); + + for dir in dirs { + let language = &dir.strip_prefix("tree-sitter-").unwrap(); + build_dir(&dir, language); + } + + // TODO: Some languages have to be handled special (when we add them in later); + // + // build_dir("tree-sitter-typescript/tsx", "tsx"); + // build_dir("tree-sitter-typescript/typescript", "typescript"); + // build_dir("tree-sitter-ocaml/ocaml", "ocaml"); + // build_dir("tree-sitter-ocaml/interface", "ocaml-interface") +} diff --git a/docker-images/syntax-highlighter/crates/sg-syntax/languages/tree-sitter-go b/docker-images/syntax-highlighter/crates/sg-syntax/languages/tree-sitter-go new file mode 160000 index 000000000000..0fa917a7022d --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-syntax/languages/tree-sitter-go @@ -0,0 +1 @@ +Subproject commit 0fa917a7022d1cd2e9b779a6a8fc5dc7fad69c75 diff --git a/docker-images/syntax-highlighter/crates/sg-syntax/languages/tree-sitter-sql b/docker-images/syntax-highlighter/crates/sg-syntax/languages/tree-sitter-sql new file mode 160000 index 000000000000..513d5389f209 --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-syntax/languages/tree-sitter-sql @@ -0,0 +1 @@ +Subproject commit 513d5389f2096d1685cf7d39623f16428720edf0 diff --git a/docker-images/syntax-highlighter/crates/sg-syntax/queries/go/highlights.scm b/docker-images/syntax-highlighter/crates/sg-syntax/queries/go/highlights.scm new file mode 100644 index 000000000000..76fa4d251ae2 --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-syntax/queries/go/highlights.scm @@ -0,0 +1,234 @@ +; ;; Forked from tree-sitter-go +; ;; Copyright (c) 2014 Max Brunsfeld (The MIT License) + +;; TODO: We can re-enable when we update SQL a bit more. +; ( +; (const_spec +; name: (identifier) @_id +; value: (expression_list (raw_string_literal) @none)) +; +; (#match? @_id ".*Query$") +; ) + +; Function calls + +(parameter_declaration (identifier) @variable.parameter) +(variadic_parameter_declaration (identifier) @variable.parameter) + +; (call_expression +; function: (selector_expression +; operand: (identifier) +; field: (field_identifier) @identifier.function) +; arguments: (_)) +; +; (call_expression +; function: (identifier) @identifier) + +(call_expression + function: (identifier) @identifer.function) + +(call_expression + function: (selector_expression + field: (field_identifier) @identifier.function)) + +; Function definitions + +(function_declaration + name: (identifier) @function) + +(method_declaration + name: (field_identifier) @method) + +; Constants + +(const_spec + name: (identifier) @constant) + +; Operators + +[ + "--" + "-" + "-=" + ":=" + "!" + "!=" + "..." + "*" + "*" + "*=" + "/" + "/=" + "&" + "&&" + "&=" + "%" + "%=" + "^" + "^=" + "+" + "++" + "+=" + "<-" + "<" + "<<" + "<<=" + "<=" + "=" + "==" + ">" + ">=" + ">>" + ">>=" + "|" + "|=" + "||" +] @operator + +; Keywords + +[ + "break" + "chan" + "const" + "continue" + "default" + "defer" + "go" + "goto" + "interface" + "map" + "range" + "select" + "struct" + "type" + "var" + "fallthrough" +] @keyword + +"func" @keyword.function +"return" @keyword.return + +"for" @keyword.repeat + +[ + "import" + "package" +] @include + +[ + "else" + "case" + "switch" + "if" +] @conditional + + +;; Builtin types + +((type_identifier) @type.builtin + (#any-of? @type.builtin + "bool" + "byte" + "complex128" + "complex64" + "error" + "float32" + "float64" + "int" + "int16" + "int32" + "int64" + "int8" + "rune" + "string" + "uint" + "uint16" + "uint32" + "uint64" + "uint8" + "uintptr")) + + +;; Builtin functions + +((identifier) @function.builtin + (#any-of? @function.builtin + "append" + "cap" + "close" + "complex" + "copy" + "delete" + "imag" + "len" + "make" + "new" + "panic" + "print" + "println" + "real" + "recover")) + + +; Delimiters + +; TODO: Olaf, you can decide if you want this one or not :) +; "." @punctuation.delimiter + +"," @punctuation.delimiter +":" @punctuation.delimiter +";" @punctuation.delimiter + +"(" @punctuation.bracket +")" @punctuation.bracket +"{" @punctuation.bracket +"}" @punctuation.bracket +"[" @punctuation.bracket +"]" @punctuation.bracket + + +; Literals + +(interpreted_string_literal) @string +(raw_string_literal) @string +(rune_literal) @string +(escape_sequence) @string.escape + +(int_literal) @number +(float_literal) @float +(imaginary_literal) @number + +(true) @boolean +(false) @boolean +(nil) @constant.null + +(comment) @comment + +(ERROR) @error + + +( + (const_spec + name: (identifier) @_id + value: (expression_list (raw_string_literal) @keyword)) + + (#match? @_id ".*Query$") +) + +;; +; Identifiers + +(package_identifier) @variable.module +(type_identifier) @type +(identifier) @variable + +; (field_identifier) @property + +( + (identifier) @constant + (#eq? @constant "_")) + +; ((identifier) @constant +; (#vim-match? @constant "^[A-Z][A-Z\\d_]+$")) + diff --git a/docker-images/syntax-highlighter/crates/sg-syntax/queries/go/injections.scm b/docker-images/syntax-highlighter/crates/sg-syntax/queries/go/injections.scm new file mode 100644 index 000000000000..24de2bdd485e --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-syntax/queries/go/injections.scm @@ -0,0 +1,9 @@ +; TODO: Need to make more updates for SQL grammar before we can put it in. +; ( +; (const_spec +; name: (identifier) @_id +; value: (expression_list (raw_string_literal) @injection.content)) +; +; (#match? @_id ".*Query$") +; (#set! injection.language "sql") +; ) diff --git a/docker-images/syntax-highlighter/crates/sg-syntax/queries/sql/highlights.scm b/docker-images/syntax-highlighter/crates/sg-syntax/queries/sql/highlights.scm new file mode 100644 index 000000000000..6e3781ff4866 --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-syntax/queries/sql/highlights.scm @@ -0,0 +1,101 @@ +(string) @string +(number) @number +(comment) @comment + +(function_call + function: (identifier) @function) + +(identifier) @variable + +[ + (NULL) + (TRUE) + (FALSE) +] @constant.builtin + +([ + (type_cast + (type) @type.builtin) + (create_function_statement + (type) @type.builtin) + (create_function_statement + (create_function_parameters + (create_function_parameter (type) @type.builtin))) + (create_type_statement + (parameters + (parameter (type) @type.builtin))) + (create_table_statement + (create_table_parameters + (create_table_column_parameter (type) @type.builtin))) + ] + (#match? + @type.builtin + "^(bigint|BIGINT|int8|INT8|bigserial|BIGSERIAL|serial8|SERIAL8|bit|BIT|varbit|VARBIT|boolean|BOOLEAN|bool|BOOL|box|BOX|bytea|BYTEA|character|CHARACTER|char|CHAR|varchar|VARCHAR|cidr|CIDR|circle|CIRCLE|date|DATE|float8|FLOAT8|inet|INET|integer|INTEGER|int|INT|int4|INT4|interval|INTERVAL|json|JSON|jsonb|JSONB|line|LINE|lseg|LSEG|macaddr|MACADDR|money|MONEY|numeric|NUMERIC|decimal|DECIMAL|path|PATH|pg_lsn|PG_LSN|point|POINT|polygon|POLYGON|real|REAL|float4|FLOAT4|smallint|SMALLINT|int2|INT2|smallserial|SMALLSERIAL|serial2|SERIAL2|serial|SERIAL|serial4|SERIAL4|text|TEXT|time|TIME|time|TIME|timestamp|TIMESTAMP|tsquery|TSQUERY|tsvector|TSVECTOR|txid_snapshot|TXID_SNAPSHOT)$")) + +[ + "::" + "<" + "<=" + "<>" + "=" + ">" + ">=" +] @operator + +[ + "(" + ")" + "[" + "]" +] @punctuation.bracket + +[ + (type) + (array_type) +] @type + +[ + (primary_key_constraint) + (unique_constraint) + (null_constraint) +] @keyword + +[ + "AS" + "CREATE" + "CREATE_DOMAIN" + "CREATE_OR_REPLACE_FUNCTION" + "CREATE_SCHEMA" + "CREATE_TABLE" + "CREATE_TYPE" + "DATABASE" + "FROM" + "GRANT" + "GROUP_BY" + "IF_NOT_EXISTS" + "INDEX" + "INNER" + "INSERT" + "INTO" + "JOIN" + "LANGUAGE" + "LEFT" + "ON" + "ORDER_BY" + "OUTER" + "PRIMARY_KEY" + "PUBLIC" + "RETURNS" + "SCHEMA" + "SELECT" + "SET" + "LOCAL" + "SESSION" + "TABLE" + "TO" + "UNIQUE" + "UPDATE" + "USAGE" + "VALUES" + "WHERE" +] @keyword diff --git a/docker-images/syntax-highlighter/crates/sg-syntax/queries/sql/injections.scm b/docker-images/syntax-highlighter/crates/sg-syntax/queries/sql/injections.scm new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/docker-images/syntax-highlighter/crates/sg-syntax/src/lib.rs b/docker-images/syntax-highlighter/crates/sg-syntax/src/lib.rs new file mode 100644 index 000000000000..4e0af1cd52a7 --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-syntax/src/lib.rs @@ -0,0 +1,227 @@ +use std::path::Path; + +use rocket::serde::json::{json, Value as JsonValue}; +use serde::Deserialize; +use syntect::html::{highlighted_html_for_string, ClassStyle}; +use syntect::{ + highlighting::ThemeSet, + parsing::{SyntaxReference, SyntaxSet}, +}; + +mod sg_treesitter; +pub use sg_treesitter::dump_document; +pub use sg_treesitter::index_language as lsif_index; +pub use sg_treesitter::lsif_highlight; +pub use sg_treesitter::PackedRange as LsifPackedRange; + +mod sg_syntect; +use sg_syntect::ClassedTableGenerator; + +thread_local! { + pub(crate) static SYNTAX_SET: SyntaxSet = SyntaxSet::load_defaults_newlines(); +} + +lazy_static::lazy_static! { + static ref THEME_SET: ThemeSet = ThemeSet::load_defaults(); +} + +/// Struct from: internal/gosyntect/gosyntect.go +/// +/// Keep in sync with that struct. +#[derive(Deserialize)] +pub struct SourcegraphQuery { + // Deprecated field with a default empty string value, kept for backwards + // compatability with old clients. + // + // TODO: Can I just delete this because this image will only run for a particular sourcegraph + // version... so they can't be out of sync anymore, which is pretty cool + #[serde(default)] + pub extension: String, + + // default empty string value for backwards compat with clients who do not specify this field. + #[serde(default)] + pub filepath: String, + + // The language defined by the server. Required to tree-sitter to use for the filetype name. + // default empty string value for backwards compat with clients who do not specify this field. + pub filetype: Option, + + // If css is set, the highlighted code will be returned as a HTML table with CSS classes + // annotating the highlighted types. + #[serde(default)] + pub css: bool, + + // line_length_limit is ignored if css is false + pub line_length_limit: Option, + + // theme is ignored if css is true + pub theme: String, + + pub code: String, +} + +pub fn determine_language<'a>( + q: &SourcegraphQuery, + syntax_set: &'a SyntaxSet, +) -> Result<&'a SyntaxReference, JsonValue> { + if q.filepath.is_empty() { + // Legacy codepath, kept for backwards-compatability with old clients. + return match syntax_set.find_syntax_by_extension(&q.extension) { + Some(v) => Ok(v), + // Fall back: Determine syntax definition by first line. + None => match syntax_set.find_syntax_by_first_line(&q.code) { + Some(v) => Ok(v), + None => Err(json!({"error": "invalid extension"})), + }, + }; + } + + // Split the input path ("foo/myfile.go") into file name + // ("myfile.go") and extension ("go"). + let path = Path::new(&q.filepath); + let file_name = path.file_name().and_then(|n| n.to_str()).unwrap_or(""); + let extension = path.extension().and_then(|x| x.to_str()).unwrap_or(""); + + // Override syntect's language detection for conflicting file extensions because + // it's impossible to express this logic in a syntax definition. + struct Override { + extension: &'static str, + prefix_langs: Vec<(&'static str, &'static str)>, + default: &'static str, + } + let overrides = vec![Override { + extension: "cls", + prefix_langs: vec![("%", "TeX"), ("\\", "TeX")], + default: "Apex", + }]; + + if let Some(Override { + prefix_langs, + default, + .. + }) = overrides.iter().find(|o| o.extension == extension) + { + let name = match prefix_langs + .iter() + .find(|(prefix, _)| q.code.starts_with(prefix)) + { + Some((_, lang)) => lang, + None => default, + }; + return Ok(syntax_set + .find_syntax_by_name(name) + .unwrap_or_else(|| syntax_set.find_syntax_plain_text())); + } + + Ok(syntax_set + // First try to find a syntax whose "extension" matches our file + // name. This is done due to some syntaxes matching an "extension" + // that is actually a whole file name (e.g. "Dockerfile" or "CMakeLists.txt") + // see https://github.com/trishume/syntect/pull/170 + .find_syntax_by_extension(file_name) + .or_else(|| syntax_set.find_syntax_by_extension(extension)) + .or_else(|| syntax_set.find_syntax_by_first_line(&q.code)) + .unwrap_or_else(|| syntax_set.find_syntax_plain_text())) +} + +pub fn list_features() { + // List embedded themes. + println!("## Embedded themes:"); + println!(); + for t in THEME_SET.themes.keys() { + println!("- `{}`", t); + } + println!(); + + // List supported file extensions. + SYNTAX_SET.with(|syntax_set| { + println!("## Supported file extensions:"); + println!(); + for sd in syntax_set.syntaxes() { + println!("- {} (`{}`)", sd.name, sd.file_extensions.join("`, `")); + } + println!(); + }); +} + +pub fn syntect_highlight(q: SourcegraphQuery) -> JsonValue { + SYNTAX_SET.with(|syntax_set| { + // Determine syntax definition by extension. + let syntax_def = match determine_language(&q, syntax_set) { + Ok(v) => v, + Err(e) => return e, + }; + + if q.css { + let output = ClassedTableGenerator::new( + syntax_set, + syntax_def, + &q.code, + q.line_length_limit, + ClassStyle::SpacedPrefixed { prefix: "hl-" }, + ) + .generate(); + + json!({ + "data": output, + "plaintext": syntax_def.name == "Plain Text", + }) + } else { + // TODO(slimsag): return the theme's background color (and other info??) to caller? + // https://github.com/trishume/syntect/blob/c8b47758a3872d478c7fc740782cd468b2c0a96b/examples/synhtml.rs#L24 + + // Determine theme to use. + // + // TODO(slimsag): We could let the query specify the theme file's actual + // bytes? e.g. via `load_from_reader`. + let theme = match THEME_SET.themes.get(&q.theme) { + Some(v) => v, + None => return json!({"error": "invalid theme", "code": "invalid_theme"}), + }; + + json!({ + "data": highlighted_html_for_string(&q.code, syntax_set, syntax_def, theme), + "plaintext": syntax_def.name == "Plain Text", + }) + } + }) +} + +#[cfg(test)] +mod tests { + use super::*; + + use syntect::parsing::SyntaxSet; + + #[test] + fn cls_tex() { + let syntax_set = SyntaxSet::load_defaults_newlines(); + let query = SourcegraphQuery { + filepath: "foo.cls".to_string(), + filetype: None, + code: "%".to_string(), + css: false, + line_length_limit: None, + extension: String::new(), + theme: String::new(), + }; + let result = determine_language(&query, &syntax_set); + assert_eq!(result.unwrap().name, "TeX"); + } + + #[test] + fn cls_apex() { + let syntax_set = SyntaxSet::load_defaults_newlines(); + let query = SourcegraphQuery { + filepath: "foo.cls".to_string(), + filetype: None, + code: "/**".to_string(), + css: false, + line_length_limit: None, + extension: String::new(), + theme: String::new(), + }; + let result = determine_language(&query, &syntax_set); + assert_eq!(result.unwrap().name, "Apex"); + } +} diff --git a/docker-images/syntax-highlighter/src/css_table.rs b/docker-images/syntax-highlighter/crates/sg-syntax/src/sg_syntect.rs similarity index 95% rename from docker-images/syntax-highlighter/src/css_table.rs rename to docker-images/syntax-highlighter/crates/sg-syntax/src/sg_syntect.rs index ea22da19cadb..bc8f2ff5b103 100644 --- a/docker-images/syntax-highlighter/src/css_table.rs +++ b/docker-images/syntax-highlighter/crates/sg-syntax/src/sg_syntect.rs @@ -61,9 +61,9 @@ impl<'a> ClassedTableGenerator<'a> { for (i, line) in LinesWithEndings::from(self.code).enumerate() { open_row(&mut self.html, i); if self.max_line_len.map_or(false, |n| line.len() > n) { - self.write_escaped_html(&line); + self.write_escaped_html(line); } else { - self.write_spans_for_line(&line); + self.write_spans_for_line(line); } close_row(&mut self.html); } @@ -156,10 +156,10 @@ impl<'a> ClassedTableGenerator<'a> { let atom = scope.atom_at(i as usize); let atom_s = repo.atom_str(atom); if i != 0 { - self.html.push_str(" ") + self.html.push(' ') } if let ClassStyle::SpacedPrefixed { prefix } = self.style { - self.html.push_str(&prefix) + self.html.push_str(prefix) } self.html.push_str(atom_s); } @@ -234,17 +234,19 @@ impl<'a> fmt::Display for Escape<'a> { #[cfg(test)] mod tests { - use crate::{highlight, Query}; + use crate::{syntect_highlight, SourcegraphQuery}; + use rocket::serde::json::json; - fn test_css_table_highlight(q: Query, expected: &str) { - let result = highlight(q); + fn test_css_table_highlight(q: SourcegraphQuery, expected: &str) { + let result = syntect_highlight(q); assert_eq!(json!({"data": expected, "plaintext": false}), result); } #[test] fn simple_css() { - let query = Query { + let query = SourcegraphQuery { filepath: "test.go".to_string(), + filetype: None, code: "package main\n".to_string(), line_length_limit: None, extension: String::new(), @@ -272,8 +274,9 @@ mod tests { // See https://github.com/sourcegraph/sourcegraph/issues/20537 #[test] fn long_line_gets_escaped() { - let query = Query { + let query = SourcegraphQuery { filepath: "test.html".to_string(), + filetype: None, code: "
test
".to_string(), line_length_limit: Some(10), extension: String::new(), @@ -295,8 +298,9 @@ mod tests { #[test] fn no_highlight_long_line() { - let query = Query { + let query = SourcegraphQuery { filepath: "test.go".to_string(), + filetype: None, code: "package main\n".to_string(), line_length_limit: Some(5), extension: String::new(), @@ -318,8 +322,9 @@ mod tests { #[test] fn multi_line_java() { - let query = Query { + let query = SourcegraphQuery { filepath: "test.java".to_string(), + filetype: None, code: "package com.lwl.boot.model;\n\npublic class Item implements Serializable {}" .to_string(), line_length_limit: None, diff --git a/docker-images/syntax-highlighter/crates/sg-syntax/src/sg_treesitter.rs b/docker-images/syntax-highlighter/crates/sg-syntax/src/sg_treesitter.rs new file mode 100644 index 000000000000..3a83b3f9bfba --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-syntax/src/sg_treesitter.rs @@ -0,0 +1,400 @@ +use paste::paste; +use protobuf::Message; +use std::collections::{HashMap, VecDeque}; +use tree_sitter_highlight::Error; +use tree_sitter_highlight::{Highlight, HighlightEvent}; + +use rocket::serde::json::serde_json::json; +use rocket::serde::json::Value as JsonValue; +use tree_sitter_highlight::{HighlightConfiguration, Highlighter as TSHighlighter}; + +use crate::SourcegraphQuery; +use sg_lsif::{Document, Occurrence, SyntaxKind}; +use sg_macros::include_project_file_optional; + +#[rustfmt::skip] +// Table of (@CaptureGroup, SyntaxKind) mapping. +// +// Any capture defined in a query will be mapped to the following SyntaxKind via the highlighter. +// +// To extend what types of captures are included, simply add a line below that takes a particular +// match group that you're interested in and map it to a new SyntaxKind. +// +// We can also define our own new capture types that we want to use and add to queries to provide +// particular highlights if necessary. +// +// (I can also add per-language mappings for these if we want, but you could also just do that with +// unique match groups. For example `@rust-bracket`, or similar. That doesn't need any +// particularly new rust code to be written. You can just modify queries for that) +const MATCHES_TO_SYNTAX_KINDS: &[(&str, SyntaxKind)] = &[ + ("attribute", SyntaxKind::UnspecifiedSyntaxKind), + ("boolean", SyntaxKind::BooleanLiteral), + ("comment", SyntaxKind::Comment), + ("conditional", SyntaxKind::IdentifierKeyword), + ("constant", SyntaxKind::IdentifierConstant), + ("constant.builtin", SyntaxKind::IdentifierBuiltin), + ("constant.null", SyntaxKind::IdentifierNull), + ("float", SyntaxKind::NumericLiteral), + ("function", SyntaxKind::IdentifierFunctionDefinition), + ("function.builtin", SyntaxKind::IdentifierBuiltin), + ("identifier", SyntaxKind::Identifier), + ("identifier.function", SyntaxKind::IdentifierFunctionDefinition), + ("include", SyntaxKind::IdentifierKeyword), + ("keyword", SyntaxKind::IdentifierKeyword), + ("keyword.function", SyntaxKind::IdentifierKeyword), + ("keyword.return", SyntaxKind::IdentifierKeyword), + ("method", SyntaxKind::Identifier), + ("number", SyntaxKind::NumericLiteral), + ("operator", SyntaxKind::IdentifierOperator), + ("property", SyntaxKind::Identifier), + ("punctuation", SyntaxKind::UnspecifiedSyntaxKind), + ("punctuation.bracket", SyntaxKind::UnspecifiedSyntaxKind), + ("punctuation.delimiter", SyntaxKind::PunctuationDelimiter), + ("string", SyntaxKind::StringLiteral), + ("string.special", SyntaxKind::StringLiteral), + ("tag", SyntaxKind::UnspecifiedSyntaxKind), + ("type", SyntaxKind::IdentifierType), + ("type.builtin", SyntaxKind::IdentifierType), + ("variable", SyntaxKind::Identifier), + ("variable.builtin", SyntaxKind::UnspecifiedSyntaxKind), + ("variable.parameter", SyntaxKind::IdentifierParameter), + ("variable.module", SyntaxKind::IdentifierModule), +]; + +/// Maps a highlight to a syntax kind. +/// This only works if you've correctly used the highlight_names from MATCHES_TO_SYNTAX_KINDS +fn get_syntax_kind_for_hl(hl: Highlight) -> SyntaxKind { + MATCHES_TO_SYNTAX_KINDS[hl.0].1 +} + +/// Add a language highlight configuration to the CONFIGURATIONS global. +/// +/// This makes it so you don't have to understand how configurations are added, +/// just add the name of filetype that you want. +macro_rules! create_configurations { + ( $($name: tt),* ) => {{ + let mut m = HashMap::new(); + let highlight_names = MATCHES_TO_SYNTAX_KINDS.iter().map(|hl| hl.0).collect::>(); + + $( + { + // Associate with tree-sitter FFI + paste! { + extern "C" { + pub fn []() -> tree_sitter::Language; + } + + // Make "safe" function from unsafe function. + fn $name() -> tree_sitter::Language { + unsafe { []() } + } + } + + // Create HighlightConfiguration language + let mut lang = HighlightConfiguration::new( + $name(), + include_project_file_optional!("queries/", $name, "/highlights.scm"), + include_project_file_optional!("queries/", $name, "/injections.scm"), + include_project_file_optional!("queries/", $name, "/locals.scm"), + ).expect(stringify!("parser for '{}' must be compiled", $name)); + + // Associate highlights with configuration + lang.configure(&highlight_names); + + // Insert into configurations, so we only create once at startup. + m.insert(stringify!($name), lang); + } + )* + + m + }} +} + +lazy_static::lazy_static! { + static ref CONFIGURATIONS: HashMap<&'static str, HighlightConfiguration> = { + create_configurations!( go, sql ) + }; +} + +pub fn jsonify_err(e: impl ToString) -> JsonValue { + json!({"error": e.to_string()}) +} + +pub fn lsif_highlight(q: SourcegraphQuery) -> Result { + let filetype = q + .filetype + .ok_or_else(|| json!({"error": "Must pass a filetype for /lsif" }))? + .to_lowercase(); + + if !CONFIGURATIONS.contains_key(filetype.as_str()) { + Err(json!({ + "error": format!("{} is not a valid filetype for treesitter", filetype) + })) + } else { + let data = index_language(&filetype, &q.code).map_err(jsonify_err)?; + let encoded = data.write_to_bytes().map_err(jsonify_err)?; + + Ok(json!({"data": base64::encode(&encoded), "plaintext": false})) + } +} + +pub fn index_language(filetype: &str, code: &str) -> Result { + let mut highlighter = TSHighlighter::new(); + let lang_config = match CONFIGURATIONS.get(filetype) { + Some(lang_config) => lang_config, + None => return Err(Error::InvalidLanguage), + }; + + // TODO: We should automatically apply no highlights when we are + // in an injected piece of code. + // + // Unfortunately, that information isn't currently available when + // we are iterating in the higlighter. + let highlights = highlighter.highlight(lang_config, code.as_bytes(), None, |l| { + CONFIGURATIONS.get(l) + })?; + + let mut emitter = LsifEmitter::new(); + emitter.render(highlights, code, &get_syntax_kind_for_hl) +} + +struct LineManager { + offsets: Vec, +} + +impl LineManager { + fn new(s: &str) -> Result { + if s.is_empty() { + // TODO: Make an error here + // Error( + } + + let mut offsets = Vec::new(); + let mut pos = 0; + for line in s.lines() { + offsets.push(pos); + pos += line.len() + 1; + } + + Ok(Self { offsets }) + } + + fn line_and_col(&self, offset: usize) -> (usize, usize) { + let mut line = 0; + for window in self.offsets.windows(2) { + let curr = window[0]; + let next = window[1]; + if next > offset { + return (line, offset - curr); + } + + line += 1; + } + + (line, offset - self.offsets.last().unwrap()) + } + + fn range(&self, start: usize, end: usize) -> Vec { + let start_line = self.line_and_col(start); + let end_line = self.line_and_col(end); + + if start_line.0 == end_line.0 { + vec![start_line.0 as i32, start_line.1 as i32, end_line.1 as i32] + } else { + vec![ + start_line.0 as i32, + start_line.1 as i32, + end_line.0 as i32, + end_line.1 as i32, + ] + } + } +} + +#[derive(Debug, PartialEq, Eq)] +pub struct PackedRange { + pub start_line: i32, + pub start_col: i32, + pub end_line: i32, + pub end_col: i32, +} + +impl PackedRange { + pub fn from_vec(v: &[i32]) -> Self { + match v.len() { + 3 => Self { + start_line: v[0], + start_col: v[1], + end_line: v[0], + end_col: v[2], + }, + 4 => Self { + start_line: v[0], + start_col: v[1], + end_line: v[2], + end_col: v[3], + }, + _ => { + panic!("Unexpected vector length: {:?}", v); + } + } + } +} + +impl PartialOrd for PackedRange { + fn partial_cmp(&self, other: &Self) -> Option { + (self.start_line, self.end_line, self.start_col).partial_cmp(&( + other.start_line, + other.end_line, + other.start_col, + )) + } +} + +impl Ord for PackedRange { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + (self.start_line, self.end_line, self.start_col).cmp(&( + other.start_line, + other.end_line, + other.start_col, + )) + } +} + +/// Converts a general-purpose syntax highlighting iterator into a sequence of lines of HTML. +pub struct LsifEmitter {} + +/// Our version of `tree_sitter_highlight::HtmlRenderer`, which emits stuff as a table. +/// +/// You can see the original version in the tree_sitter_highlight crate. +impl LsifEmitter { + pub fn new() -> Self { + LsifEmitter {} + } + + pub fn render( + &mut self, + highlighter: impl Iterator>, + source: &str, + _attribute_callback: &F, + ) -> Result + where + F: Fn(Highlight) -> SyntaxKind, + { + // let mut highlights = Vec::new(); + let mut doc = Document::new(); + + let line_manager = LineManager::new(source)?; + + let mut highlights = vec![]; + for event in highlighter { + match event { + Ok(HighlightEvent::HighlightStart(s)) => highlights.push(s), + Ok(HighlightEvent::HighlightEnd) => { + highlights.pop(); + } + + // No highlights matched + Ok(HighlightEvent::Source { .. }) if highlights.is_empty() => {} + + // When a `start`->`end` has some highlights + Ok(HighlightEvent::Source { start, end }) => { + let mut occurence = Occurrence::new(); + occurence.range = line_manager.range(start, end); + occurence.syntax_kind = get_syntax_kind_for_hl(*highlights.last().unwrap()); + + doc.occurrences.push(occurence); + } + Err(a) => return Err(a), + } + } + + Ok(doc) + } +} + +pub fn dump_document(doc: Document, source: &str) -> String { + let mut occurences = doc.get_occurrences().to_owned(); + occurences.sort_by_key(|o| PackedRange::from_vec(&o.range)); + let mut occurences = VecDeque::from(occurences); + + let mut result = String::new(); + + for (idx, line) in source.lines().enumerate() { + result += " "; + result += &line.replace("\t", " "); + result += "\n"; + + while let Some(occ) = occurences.pop_front() { + if occ.syntax_kind == SyntaxKind::UnspecifiedSyntaxKind { + continue; + } + + let range = PackedRange::from_vec(&occ.range); + if range.start_line != range.end_line { + continue; + } + + if range.start_line != idx as i32 { + occurences.push_front(occ); + break; + } + + let length = (range.end_col - range.start_col) as usize; + + result.push_str(&format!( + "//{}{} {:?}\n", + " ".repeat(range.start_col as usize), + "^".repeat(length), + occ.syntax_kind + )); + } + } + + result +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_highlights_one_comment() -> Result<(), Error> { + let src = "// Hello World"; + let document = index_language("go", src)?; + insta::assert_snapshot!(dump_document(document, src)); + + Ok(()) + } + + #[test] + fn test_highlights_simple_main() -> Result<(), Error> { + let src = r#"package main +import "fmt" + +func main() { + fmt.Println("Hello, world", 5) +} +"#; + + let document = index_language("go", src)?; + insta::assert_snapshot!(dump_document(document, src)); + + Ok(()) + } + + #[test] + fn test_highlights_a_sql_query_within_go() -> Result<(), Error> { + let src = r#"package main + +const MySqlQuery = ` +SELECT * FROM my_table +` +"#; + + let document = index_language("go", src)?; + insta::assert_snapshot!(dump_document(document, src)); + + Ok(()) + } +} diff --git a/docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/sg_syntax__sg_treesitter__test__highlights_a_sql_query_within_go.snap b/docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/sg_syntax__sg_treesitter__test__highlights_a_sql_query_within_go.snap new file mode 100644 index 000000000000..67531fbdd3f6 --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/sg_syntax__sg_treesitter__test__highlights_a_sql_query_within_go.snap @@ -0,0 +1,17 @@ +--- +source: crates/sg-syntax/src/sg_treesitter.rs +assertion_line: 396 +expression: "dump_document(document, src)" + +--- + package main +//^^^^^^^ IdentifierKeyword +// ^^^^ IdentifierModule + + const MySqlQuery = ` +//^^^^^ IdentifierKeyword +// ^^^^^^^^^^ IdentifierConstant +// ^ IdentifierOperator + SELECT * FROM my_table + ` + diff --git a/docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/sg_syntax__sg_treesitter__test__highlights_one_comment.snap b/docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/sg_syntax__sg_treesitter__test__highlights_one_comment.snap new file mode 100644 index 000000000000..875d2d9aaf7f --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/sg_syntax__sg_treesitter__test__highlights_one_comment.snap @@ -0,0 +1,8 @@ +--- +source: crates/sg-syntax/src/sg_treesitter.rs +assertion_line: 374 +expression: "dump_document(document, src)" +--- + // Hello World +//^^^^^^^^^^^^^^ Comment + diff --git a/docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/sg_syntax__sg_treesitter__test__highlights_simple_main.snap b/docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/sg_syntax__sg_treesitter__test__highlights_simple_main.snap new file mode 100644 index 000000000000..39556df2ec34 --- /dev/null +++ b/docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/sg_syntax__sg_treesitter__test__highlights_simple_main.snap @@ -0,0 +1,24 @@ +--- +source: crates/sg-syntax/src/sg_treesitter.rs +assertion_line: 381 +expression: "dump_document(document, src)" + +--- + package main +//^^^^^^^ IdentifierKeyword +// ^^^^ IdentifierModule + import "fmt" +//^^^^^^ IdentifierKeyword +// ^^^^^ StringLiteral + + func main() { +//^^^^ IdentifierKeyword +// ^^^^ IdentifierFunctionDefinition + fmt.Println("Hello, world", 5) +// ^^^ IdentifierBuiltin +// ^^^^^^^ IdentifierFunctionDefinition +// ^^^^^^^^^^^^^^ StringLiteral +// ^ PunctuationDelimiter +// ^ NumericLiteral + } + diff --git a/docker-images/syntax-highlighter/docs/api.md b/docker-images/syntax-highlighter/docs/api.md new file mode 100644 index 000000000000..24999f4e41dc --- /dev/null +++ b/docker-images/syntax-highlighter/docs/api.md @@ -0,0 +1,20 @@ +# API + +## `/` + +- `POST` to `/` with `Content-Type: application/json`. The following fields are required: + - `filepath` string, e.g. `the/file.go` or `file.go` or `Dockerfile`, see "Supported file extensions" section below. + - `theme` string, e.g. `Solarized (dark)`, see "Embedded themes" section below. + - `code` string, i.e. the literal code to highlight. +- The response is a JSON object of either: + - A successful response (`data` field): + - `data` string with syntax highlighted response. The input `code` string [is properly escaped](https://github.com/sourcegraph/syntect_server/blob/ee3810f70e5701b961b7249393dbac8914c162ce/syntect/src/html.rs#L6) and as such can be directly rendered in the browser safely. + - `plaintext` boolean indicating whether a syntax could not be found for the file and instead it was rendered as plain text. + - An error response (`error` field), one of: + - `{"error": "invalid theme", "code": "invalid_theme"}` + - `{"error": "resource not found", "code": "resource_not_found"}` +- `GET` to `/health` to receive an `OK` health check response / ensure the service is alive. + +## `/lsif` + +Returns base64-encoded LSIF document diff --git a/docker-images/syntax-highlighter/docs/testing.md b/docker-images/syntax-highlighter/docs/testing.md new file mode 100644 index 000000000000..649417e7744c --- /dev/null +++ b/docker-images/syntax-highlighter/docs/testing.md @@ -0,0 +1,19 @@ +# Running Tests + +Currently, we use `insta` to run snapshot tests (and cargo as the test runner). + +## Using `insta` + +``` +$ cargo install cargo-insta +``` + +Run tests with `$ cargo test`. If you have failures, you can do this cool thing: + +``` +$ cargo insta review +``` + +And that will lead you through any failures from the snapshot tests + +(more to write here and links to add later) diff --git a/docker-images/syntax-highlighter/go.mod b/docker-images/syntax-highlighter/go.mod new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/docker-images/syntax-highlighter/rust-toolchain b/docker-images/syntax-highlighter/rust-toolchain index 3f4830156cbe..79f82f6b8e0c 100644 --- a/docker-images/syntax-highlighter/rust-toolchain +++ b/docker-images/syntax-highlighter/rust-toolchain @@ -1 +1 @@ -1.53.0 +1.58.0 diff --git a/docker-images/syntax-highlighter/src/bin/lsif-snapshot.rs b/docker-images/syntax-highlighter/src/bin/lsif-snapshot.rs new file mode 100644 index 000000000000..5b2593a0bb8f --- /dev/null +++ b/docker-images/syntax-highlighter/src/bin/lsif-snapshot.rs @@ -0,0 +1,29 @@ +use std::fs; + +use sg_syntax::{dump_document, lsif_index}; + +fn main() { + if let Some(path) = std::env::args().nth(1) { + let contents = match fs::read_to_string(&path) { + Ok(contents) => contents, + Err(err) => { + eprintln!("Failed to read path: {:?}. {}", path, err); + return; + } + }; + + // let language = determine_language(); + let document = match lsif_index("go", &contents) { + Ok(document) => document, + Err(err) => { + eprintln!("Failed to index document: {:?}", err); + return; + } + }; + + println!("\n\n{}", dump_document(document, &contents)); + // println!("{}", dump_document()) + } else { + panic!("Must pass a filepath"); + } +} diff --git a/docker-images/syntax-highlighter/src/main.rs b/docker-images/syntax-highlighter/src/main.rs index 8bb7bb324b20..02e9cb5e1200 100644 --- a/docker-images/syntax-highlighter/src/main.rs +++ b/docker-images/syntax-highlighter/src/main.rs @@ -1,218 +1,29 @@ #![allow(macro_expanded_macro_exports_accessed_by_absolute_paths)] -#[macro_use] -extern crate lazy_static; -extern crate rayon; #[macro_use] extern crate rocket; -#[macro_use] -extern crate rocket_contrib; -#[macro_use] -extern crate serde_derive; -extern crate serde_json; -extern crate syntect; - -use rocket_contrib::json::{Json, JsonValue}; -use std::env; -use std::panic; -use std::path::Path; -use syntect::parsing::SyntaxReference; -use syntect::{ - highlighting::ThemeSet, - html::{highlighted_html_for_string, ClassStyle}, - parsing::SyntaxSet, -}; - -mod css_table; -use css_table::ClassedTableGenerator; - -thread_local! { - static SYNTAX_SET: SyntaxSet = SyntaxSet::load_defaults_newlines(); -} - -lazy_static! { - static ref THEME_SET: ThemeSet = ThemeSet::load_defaults(); -} - -#[derive(Deserialize)] -struct Query { - // Deprecated field with a default empty string value, kept for backwards - // compatability with old clients. - #[serde(default)] - extension: String, - // default empty string value for backwards compat with clients who do not specify this field. - #[serde(default)] - filepath: String, - - // If css is set, the highlighted code will be returned as a HTML table with CSS classes - // annotating the highlighted types. - #[serde(default)] - css: bool, - - // line_length_limit is ignored if css is false - line_length_limit: Option, - - // theme is ignored if css is true - theme: String, - - code: String, -} +use rocket::serde::json::{json, Json, Value as JsonValue}; +use sg_syntax::SourcegraphQuery; #[post("/", format = "application/json", data = "")] -fn index(q: Json) -> JsonValue { +fn syntect(q: Json) -> JsonValue { // TODO(slimsag): In an ideal world we wouldn't be relying on catch_unwind // and instead Syntect would return Result types when failures occur. This // will require some non-trivial work upstream: // https://github.com/trishume/syntect/issues/98 - let result = panic::catch_unwind(|| highlight(q.into_inner())); + let result = std::panic::catch_unwind(|| sg_syntax::syntect_highlight(q.into_inner())); match result { Ok(v) => v, Err(_) => json!({"error": "panic while highlighting code", "code": "panic"}), } } -fn highlight(q: Query) -> JsonValue { - SYNTAX_SET.with(|syntax_set| { - // Determine syntax definition by extension. - let syntax_def = match determine_language(&q, syntax_set) { - Ok(v) => v, - Err(e) => return e, - }; - - if q.css { - let output = ClassedTableGenerator::new( - &syntax_set, - &syntax_def, - &q.code, - q.line_length_limit, - ClassStyle::SpacedPrefixed { prefix: "hl-" }, - ) - .generate(); - - json!({ - "data": output, - "plaintext": syntax_def.name == "Plain Text", - }) - } else { - // TODO(slimsag): return the theme's background color (and other info??) to caller? - // https://github.com/trishume/syntect/blob/c8b47758a3872d478c7fc740782cd468b2c0a96b/examples/synhtml.rs#L24 - - // Determine theme to use. - // - // TODO(slimsag): We could let the query specify the theme file's actual - // bytes? e.g. via `load_from_reader`. - let theme = match THEME_SET.themes.get(&q.theme) { - Some(v) => v, - None => return json!({"error": "invalid theme", "code": "invalid_theme"}), - }; - - json!({ - "data": highlighted_html_for_string(&q.code, &syntax_set, &syntax_def, theme), - "plaintext": syntax_def.name == "Plain Text", - }) - } - }) -} - -fn determine_language<'a>( - q: &Query, - syntax_set: &'a SyntaxSet, -) -> Result<&'a SyntaxReference, JsonValue> { - if q.filepath == "" { - // Legacy codepath, kept for backwards-compatability with old clients. - return match syntax_set.find_syntax_by_extension(&q.extension) { - Some(v) => Ok(v), - // Fall back: Determine syntax definition by first line. - None => match syntax_set.find_syntax_by_first_line(&q.code) { - Some(v) => Ok(v), - None => Err(json!({"error": "invalid extension"})), - }, - }; - } - - // Split the input path ("foo/myfile.go") into file name - // ("myfile.go") and extension ("go"). - let path = Path::new(&q.filepath); - let file_name = path.file_name().and_then(|n| n.to_str()).unwrap_or(""); - let extension = path.extension().and_then(|x| x.to_str()).unwrap_or(""); - - // Override syntect's language detection for conflicting file extensions because - // it's impossible to express this logic in a syntax definition. - struct Override { - extension: &'static str, - prefix_langs: Vec<(&'static str, &'static str)>, - default: &'static str, - } - let overrides = vec![Override { - extension: "cls", - prefix_langs: vec![("%", "TeX"), ("\\", "TeX")], - default: "Apex", - }]; - - if let Some(Override { - prefix_langs, - default, - .. - }) = overrides.iter().find(|o| o.extension == extension) - { - let name = match prefix_langs - .iter() - .find(|(prefix, _)| q.code.starts_with(prefix)) - { - Some((_, lang)) => lang, - None => default, - }; - return Ok(syntax_set - .find_syntax_by_name(name) - .unwrap_or_else(|| syntax_set.find_syntax_plain_text())); - } - - Ok(syntax_set - // First try to find a syntax whose "extension" matches our file - // name. This is done due to some syntaxes matching an "extension" - // that is actually a whole file name (e.g. "Dockerfile" or "CMakeLists.txt") - // see https://github.com/trishume/syntect/pull/170 - .find_syntax_by_extension(file_name) - .or_else(|| syntax_set.find_syntax_by_extension(extension)) - .or_else(|| syntax_set.find_syntax_by_first_line(&q.code)) - .unwrap_or_else(|| syntax_set.find_syntax_plain_text())) -} - -#[cfg(test)] -mod tests { - use syntect::parsing::SyntaxSet; - - use crate::{Query, determine_language}; - - #[test] - fn cls_tex() { - let syntax_set = SyntaxSet::load_defaults_newlines(); - let query = Query { - filepath: "foo.cls".to_string(), - code: "%".to_string(), - css: false, - line_length_limit: None, - extension: String::new(), - theme: String::new(), - }; - let result = determine_language(&query, &syntax_set); - assert_eq!(result.unwrap().name, "TeX"); - } - - #[test] - fn cls_apex() { - let syntax_set = SyntaxSet::load_defaults_newlines(); - let query = Query { - filepath: "foo.cls".to_string(), - code: "/**".to_string(), - css: false, - line_length_limit: None, - extension: String::new(), - theme: String::new(), - }; - let result = determine_language(&query, &syntax_set); - assert_eq!(result.unwrap().name, "Apex"); +#[post("/lsif", format = "application/json", data = "")] +fn lsif(q: Json) -> JsonValue { + match sg_syntax::lsif_highlight(q.into_inner()) { + Ok(v) => v, + Err(err) => err, } } @@ -226,39 +37,15 @@ fn not_found() -> JsonValue { json!({"error": "resource not found", "code": "resource_not_found"}) } -fn list_features() { - // List embedded themes. - println!("## Embedded themes:"); - println!(""); - for t in THEME_SET.themes.keys() { - println!("- `{}`", t); - } - println!(""); - - // List supported file extensions. - SYNTAX_SET.with(|syntax_set| { - println!("## Supported file extensions:"); - println!(""); - for sd in syntax_set.syntaxes() { - println!("- {} (`{}`)", sd.name, sd.file_extensions.join("`, `")); - } - println!(""); - }); -} - #[launch] -fn rocket() -> rocket::Rocket { +fn rocket() -> _ { // Only list features if QUIET != "true" - match env::var("QUIET") { - Ok(v) => { - if v != "true" { - list_features() - } - } - Err(_) => list_features(), + match std::env::var("QUIET") { + Ok(v) if v == "true" => {} + _ => sg_syntax::list_features(), }; - rocket::ignite() - .mount("/", routes![index, health]) - .register(catchers![not_found]) + rocket::build() + .mount("/", routes![syntect, lsif, health]) + .register("/", catchers![not_found]) } diff --git a/go.mod b/go.mod index 905222aae2ec..3d221ed558df 100644 --- a/go.mod +++ b/go.mod @@ -137,7 +137,6 @@ require ( github.com/sourcegraph/go-langserver v2.0.1-0.20181108233942-4a51fa2e1238+incompatible github.com/sourcegraph/go-lsp v0.0.0-20200429204803-219e11d77f5d github.com/sourcegraph/go-rendezvous v0.0.0-20210910070954-ef39ade5591d - github.com/sourcegraph/gosyntect v0.0.0-20210422223331-645353f16ddc github.com/sourcegraph/jsonx v0.0.0-20200629203448-1a936bd500cf github.com/sourcegraph/sourcegraph/enterprise/dev/ci/images v0.0.0-20220203145655-4d2a39d3038a github.com/sourcegraph/sourcegraph/lib v0.0.0-20220203145655-4d2a39d3038a @@ -270,7 +269,7 @@ require ( github.com/go-openapi/swag v0.21.1 // indirect github.com/go-openapi/validate v0.20.3 // indirect github.com/go-stack/stack v1.8.1 // indirect - github.com/gogo/protobuf v1.3.2 // indirect + github.com/gogo/protobuf v1.3.2 github.com/golang-jwt/jwt/v4 v4.2.0 github.com/google/gofuzz v1.2.0 // indirect github.com/google/pprof v0.0.0-20220128192902-513e8ac6eea1 // indirect diff --git a/go.sum b/go.sum index d27ae613e6ad..51452a2edfaf 100644 --- a/go.sum +++ b/go.sum @@ -1766,7 +1766,6 @@ github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mo github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE= github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= -github.com/opentracing-contrib/go-stdlib v0.0.0-20190519235532-cf7a6c988dc9/go.mod h1:PLldrQSroqzH70Xl+1DQcGnefIbqsKR7UDaiux3zV+w= github.com/opentracing-contrib/go-stdlib v1.0.0 h1:TBS7YuVotp8myLon4Pv7BtCBzOTo1DeZCld0Z63mW2w= github.com/opentracing-contrib/go-stdlib v1.0.0/go.mod h1:qtI1ogk+2JhVPIXVc6q+NHziSmy2W5GbdQZFUHADCBU= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -2010,8 +2009,6 @@ github.com/sourcegraph/gologin v1.0.2-0.20181110030308-c6f1b62954d8 h1:K7hzuWsJG github.com/sourcegraph/gologin v1.0.2-0.20181110030308-c6f1b62954d8/go.mod h1:0VfoEApmSPgPhnePllwhrB4vwCUkI0K0w8aueOgoJQI= github.com/sourcegraph/gosaml2 v0.6.1-0.20210128133756-84151d087b10 h1:lLSG41QZ5I81jSOakWLB1qEXZhJ65spo81f4SEd8Z20= github.com/sourcegraph/gosaml2 v0.6.1-0.20210128133756-84151d087b10/go.mod h1:CAOGXqoL6YYtu7kCSx69SZlbNZWbwUchYzOacZatJ3s= -github.com/sourcegraph/gosyntect v0.0.0-20210422223331-645353f16ddc h1:iaDqNUpXf8FKUzw1pZrA6NrpILji4OigouwD9OSyamo= -github.com/sourcegraph/gosyntect v0.0.0-20210422223331-645353f16ddc/go.mod h1:WiNJKgKTnR3psOIGzVZQjLqZjJZuoL3F8tCh25Uk8dU= github.com/sourcegraph/httpgzip v0.0.0-20211015085752-0bad89b3b4df h1:VaS8k40GiNVUxVx0ZUilU38NU6tWUHNQOX342DWtZUM= github.com/sourcegraph/httpgzip v0.0.0-20211015085752-0bad89b3b4df/go.mod h1:RqWagzxNGCvucQQC9vX6aps474LCCOgshDpUTTyb+O8= github.com/sourcegraph/jsonx v0.0.0-20200629203448-1a936bd500cf h1:oAdWFqhStsWiiMP/vkkHiMXqFXzl1XfUNOdxKJbd6bI= diff --git a/internal/gosyntect/gosyntect.go b/internal/gosyntect/gosyntect.go new file mode 100644 index 000000000000..9a5679cd2057 --- /dev/null +++ b/internal/gosyntect/gosyntect.go @@ -0,0 +1,220 @@ +package gosyntect + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "net/http" + "strings" + "time" + + "github.com/opentracing-contrib/go-stdlib/nethttp" + opentracing "github.com/opentracing/opentracing-go" + "github.com/sourcegraph/sourcegraph/lib/errors" +) + +// Query represents a code highlighting query to the syntect_server. +type Query struct { + // Filepath is the file path of the code. It can be the full file path, or + // just the name and extension. + // + // See: https://github.com/sourcegraph/syntect_server#supported-file-extensions + Filepath string `json:"filepath"` + + // Filetype is the language name. + Filetype string `json:"filetype"` + + // Theme is the color theme to use for highlighting. + // If CSS is true, theme is ignored. + // + // See https://github.com/sourcegraph/syntect_server#embedded-themes + Theme string `json:"theme"` + + // Code is the literal code to highlight. + Code string `json:"code"` + + // CSS causes results to be returned in HTML table format with CSS class + // names annotating the spans rather than inline styles. + // + // TODO: I think we can just delete this? And theme? We don't use these. + // Then we could remove themes from syntect as well. I don't think we + // have any use case for these anymore (and haven't for awhile). + CSS bool `json:"css"` + + // LineLengthLimit is the maximum length of line that will be highlighted if set. + // Defaults to no max if zero. + // If CSS is false, LineLengthLimit is ignored. + LineLengthLimit int `json:"line_length_limit,omitempty"` + + // StabilizeTimeout, if non-zero, overrides the default syntect_server + // http-server-stabilizer timeout of 10s. This is most useful when a user + // is requesting to highlight a very large file and is willing to wait + // longer, but it is important this not _always_ be a long duration because + // the worker's threads could get stuck at 100% CPU for this amount of + // time if the user's request ends up being a problematic one. + StabilizeTimeout time.Duration `json:"-"` + + // Tracer, if not nil, will be used to record opentracing spans associated with the query. + Tracer opentracing.Tracer +} + +// Response represents a response to a code highlighting query. +type Response struct { + // Data is the actual highlighted HTML version of Query.Code. + Data string + + // LSIF is the base64 encoded byte array of an LSIF Typed payload containing highlighting data. + LSIF string + + // Plaintext indicates whether or not a syntax could not be found for the + // file and instead it was rendered as plain text. + Plaintext bool +} + +var ( + // ErrInvalidTheme is returned when the Query.Theme is not a valid theme. + ErrInvalidTheme = errors.New("invalid theme") + + // ErrRequestTooLarge is returned when the request is too large for syntect_server to handle (e.g. file is too large to highlight). + ErrRequestTooLarge = errors.New("request too large") + + // ErrPanic occurs when syntect_server panics while highlighting code. This + // most often occurs when Syntect does not support e.g. an obscure or + // relatively unused sublime-syntax feature and as a result panics. + ErrPanic = errors.New("syntect panic while highlighting") + + // ErrHSSWorkerTimeout occurs when syntect_server's wrapper, + // http-server-stabilizer notices syntect_server is taking too long to + // serve a request, has most likely gotten stuck, and as such has been + // restarted. This occurs rarely on certain files syntect_server cannot yet + // handle for some reason. + ErrHSSWorkerTimeout = errors.New("HSS worker timeout while serving request") +) + +type response struct { + // Successful response fields. + Data string `json:"data"` + Plaintext bool `json:"plaintext"` + + // Error response fields. + Error string `json:"error"` + Code string `json:"code"` +} + +var supportedFiletypes = map[string]struct{}{ + "go": {}, +} + +// Client represents a client connection to a syntect_server. +type Client struct { + syntectServer string +} + +var client = &http.Client{Transport: &nethttp.Transport{}} + +func (c *Client) IsTreesitterSupported(filetype string) bool { + _, contained := supportedFiletypes[strings.ToLower(filetype)] + return contained +} + +// Highlight performs a query to highlight some code. +// +// TOOD(tjdevries): I think it would be good to remove `useTreeSitter` as a +// variable and instead use either two different callpaths or just +// automatically do this via the query or something else. It feels a bit goofy +// to be a separate param. But I need to clean up these other deprecated +// options later, so it's OK for the first iteration. +func (c *Client) Highlight(ctx context.Context, q *Query, useTreeSitter bool) (*Response, error) { + if useTreeSitter && !c.IsTreesitterSupported(q.Filetype) { + return nil, errors.New("Not a valid treesitter filetype") + } + + // Build the request. + jsonQuery, err := json.Marshal(q) + if err != nil { + return nil, errors.Wrap(err, "encoding query") + } + + var url string + if useTreeSitter { + url = "/lsif" + } else { + url = "/" + } + + req, err := http.NewRequest("POST", c.url(url), bytes.NewReader(jsonQuery)) + if err != nil { + return nil, errors.Wrap(err, "building request") + } + req.Header.Set("Content-Type", "application/json") + if q.StabilizeTimeout != 0 { + req.Header.Set("X-Stabilize-Timeout", q.StabilizeTimeout.String()) + } + + // Add tracing to the request. + tracer := q.Tracer + if tracer == nil { + tracer = opentracing.NoopTracer{} + } + req = req.WithContext(ctx) + req, ht := nethttp.TraceRequest(tracer, req, + nethttp.OperationName("Highlight"), + nethttp.ClientTrace(false)) + defer ht.Finish() + + // Perform the request. + resp, err := client.Do(req) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("making request to %s", c.url("/"))) + } + defer resp.Body.Close() + + if resp.StatusCode == http.StatusBadRequest { + return nil, ErrRequestTooLarge + } + + // Can only call ht.Span() after the request has been executed, so add our span tags in now. + ht.Span().SetTag("Filepath", q.Filepath) + ht.Span().SetTag("Theme", q.Theme) + ht.Span().SetTag("CSS", q.CSS) + + // Decode the response. + var r response + if err := json.NewDecoder(resp.Body).Decode(&r); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("decoding JSON response from %s", c.url("/"))) + } + if r.Error != "" { + var err error + switch r.Code { + case "invalid_theme": + err = ErrInvalidTheme + case "resource_not_found": + // resource_not_found is returned in the event of a 404, indicating a bug + // in gosyntect. + err = errors.New("gosyntect internal error: resource_not_found") + case "panic": + err = ErrPanic + case "hss_worker_timeout": + err = ErrHSSWorkerTimeout + default: + err = errors.Errorf("unknown error=%q code=%q", r.Error, r.Code) + } + return nil, errors.Wrap(err, c.syntectServer) + } + return &Response{ + Data: r.Data, + Plaintext: r.Plaintext, + }, nil +} + +func (c *Client) url(path string) string { + return c.syntectServer + path +} + +// New returns a client connection to a syntect_server. +func New(syntectServer string) *Client { + return &Client{ + syntectServer: strings.TrimSuffix(syntectServer, "/"), + } +} diff --git a/lib/codeintel/lsiftyped/lsif.pb.go b/lib/codeintel/lsiftyped/lsif.pb.go index ba0b3fe6ac0d..24aeccb254a8 100644 --- a/lib/codeintel/lsiftyped/lsif.pb.go +++ b/lib/codeintel/lsiftyped/lsif.pb.go @@ -199,148 +199,159 @@ type SyntaxKind int32 const ( SyntaxKind_UnspecifiedSyntaxKind SyntaxKind = 0 - // `+`, `*`, etc. - SyntaxKind_Operator SyntaxKind = 1 // Comment, including comment markers and text - SyntaxKind_Comment SyntaxKind = 2 + SyntaxKind_Comment SyntaxKind = 1 // `;` `.` `,` - SyntaxKind_PunctuationDelimiter SyntaxKind = 3 + SyntaxKind_PunctuationDelimiter SyntaxKind = 2 // (), {}, [] when used syntactically - SyntaxKind_PunctuationBracket SyntaxKind = 4 - // `{}` within a string. - SyntaxKind_PunctuationSpecial SyntaxKind = 5 + SyntaxKind_PunctuationBracket SyntaxKind = 3 // `if`, `else`, `return`, `class`, etc. - SyntaxKind_Keyword SyntaxKind = 6 - // non-specific variables, function calls, etc. - // In general, prefer more specific identifier kinds if possible. - SyntaxKind_Identifier SyntaxKind = 7 + SyntaxKind_IdentifierKeyword SyntaxKind = 4 + // `+`, `*`, etc. + SyntaxKind_IdentifierOperator SyntaxKind = 5 + // non-specific catch-all for any identifier not better described elsewhere + SyntaxKind_Identifier SyntaxKind = 6 // Identifiers builtin to the language: `min`, `print` in Python. - SyntaxKind_BuiltinIdentifier SyntaxKind = 8 - // Identifiers builtin to the language: `None` in Python, `nil` in Go. - SyntaxKind_NullIdentifier SyntaxKind = 9 + SyntaxKind_IdentifierBuiltin SyntaxKind = 7 + // Identifiers representing `null`-like values: `None` in Python, `nil` in Go. + SyntaxKind_IdentifierNull SyntaxKind = 8 // `xyz` in `const xyz = "hello"` - SyntaxKind_ConstantIdentifier SyntaxKind = 10 + SyntaxKind_IdentifierConstant SyntaxKind = 9 // `var X = "hello"` in Go - SyntaxKind_MutableGlobalIdentifier SyntaxKind = 11 + SyntaxKind_IdentifierMutableGlobal SyntaxKind = 10 // both parameter definition and references - SyntaxKind_ParameterIdentifier SyntaxKind = 12 + SyntaxKind_IdentifierParameter SyntaxKind = 11 // identifiers for variable definitions and references within a local scope - SyntaxKind_LocalIdentifier SyntaxKind = 13 + SyntaxKind_IdentifierLocal SyntaxKind = 12 // Used when identifier shadowes some other identifier within the scope - SyntaxKind_ShadowedIdentifier SyntaxKind = 14 + SyntaxKind_IdentifierShadowed SyntaxKind = 13 // `package main` - SyntaxKind_ModuleIdentifier SyntaxKind = 15 - // Macro references only, not definitions - SyntaxKind_MacroIdentifier SyntaxKind = 16 + SyntaxKind_IdentifierModule SyntaxKind = 14 + // Function call/reference + SyntaxKind_IdentifierFunction SyntaxKind = 15 + // Function definition only + SyntaxKind_IdentifierFunctionDefinition SyntaxKind = 16 + // Macro call/reference + SyntaxKind_IdentifierMacro SyntaxKind = 17 + // Macro definition only + SyntaxKind_IdentifierMacroDefinition SyntaxKind = 18 + // non-builtin types, including namespaces + SyntaxKind_IdentifierType SyntaxKind = 19 + // builtin types only, such as `str` for Python or `int` in Go + SyntaxKind_IdentifierBuiltinType SyntaxKind = 20 + // Python decorators, c-like __attribute__ + SyntaxKind_IdentifierAttribute SyntaxKind = 21 + // `\b` + SyntaxKind_RegexEscape SyntaxKind = 22 + // `*`, `+` + SyntaxKind_RegexRepeated SyntaxKind = 23 + // `.` + SyntaxKind_RegexWildcard SyntaxKind = 24 + // `(`, `)`, `[`, `]` + SyntaxKind_RegexDelimiter SyntaxKind = 25 + // `|`, `-` + SyntaxKind_RegexJoin SyntaxKind = 26 // Literal strings: "Hello, world!" - SyntaxKind_StringLiteral SyntaxKind = 17 - // ".*" in a string regex - SyntaxKind_StringLiteralRegex SyntaxKind = 18 - // "\t", "\n" - SyntaxKind_StringLiteralEscape SyntaxKind = 19 - // datetimes within strings, special words within a string - SyntaxKind_StringLiteralSpecial SyntaxKind = 20 - // "key" in { "key": "value" } - SyntaxKind_StringLiteralKey SyntaxKind = 21 + SyntaxKind_StringLiteral SyntaxKind = 27 + // non-regex escapes: "\t", "\n" + SyntaxKind_StringLiteralEscape SyntaxKind = 28 + // datetimes within strings, special words within a string, `{}` in format strings + SyntaxKind_StringLiteralSpecial SyntaxKind = 29 + // "key" in { "key": "value" }, useful for example in JSON + SyntaxKind_StringLiteralKey SyntaxKind = 30 // 'c' or similar, in languages that differentiate strings and characters - SyntaxKind_CharacterLiteral SyntaxKind = 22 + SyntaxKind_CharacterLiteral SyntaxKind = 31 // Literal numbers, both floats and integers - SyntaxKind_NumericLiteral SyntaxKind = 23 + SyntaxKind_NumericLiteral SyntaxKind = 32 // `true`, `false` - SyntaxKind_BooleanLiteral SyntaxKind = 24 - // Function definition only. - // Included because many editors highlight a function definition differently - // from function calls. - SyntaxKind_FunctionDefinition SyntaxKind = 25 - // Macro definition only. - // Included because many editors highlight a macro definition differently - // from macro usages. - SyntaxKind_MacroDefinition SyntaxKind = 26 - // non-builtin types, including namespaces - SyntaxKind_TypeIdentifier SyntaxKind = 27 - // builtin types only, such as `str` for Python or `int` in Go - SyntaxKind_BuiltinTypeIdentifier SyntaxKind = 28 - // Python decorators, c-like __attribute__ - SyntaxKind_AttributeIdentifier SyntaxKind = 29 + SyntaxKind_BooleanLiteral SyntaxKind = 33 // Used for XML-like tags - SyntaxKind_Tag SyntaxKind = 30 + SyntaxKind_Tag SyntaxKind = 34 // Attribute name in XML-like tags - SyntaxKind_TagAttribute SyntaxKind = 31 + SyntaxKind_TagAttribute SyntaxKind = 35 // Delimiters for XML-like tags - SyntaxKind_TagDelimiter SyntaxKind = 32 + SyntaxKind_TagDelimiter SyntaxKind = 36 ) // Enum value maps for SyntaxKind. var ( SyntaxKind_name = map[int32]string{ 0: "UnspecifiedSyntaxKind", - 1: "Operator", - 2: "Comment", - 3: "PunctuationDelimiter", - 4: "PunctuationBracket", - 5: "PunctuationSpecial", - 6: "Keyword", - 7: "Identifier", - 8: "BuiltinIdentifier", - 9: "NullIdentifier", - 10: "ConstantIdentifier", - 11: "MutableGlobalIdentifier", - 12: "ParameterIdentifier", - 13: "LocalIdentifier", - 14: "ShadowedIdentifier", - 15: "ModuleIdentifier", - 16: "MacroIdentifier", - 17: "StringLiteral", - 18: "StringLiteralRegex", - 19: "StringLiteralEscape", - 20: "StringLiteralSpecial", - 21: "StringLiteralKey", - 22: "CharacterLiteral", - 23: "NumericLiteral", - 24: "BooleanLiteral", - 25: "FunctionDefinition", - 26: "MacroDefinition", - 27: "TypeIdentifier", - 28: "BuiltinTypeIdentifier", - 29: "AttributeIdentifier", - 30: "Tag", - 31: "TagAttribute", - 32: "TagDelimiter", + 1: "Comment", + 2: "PunctuationDelimiter", + 3: "PunctuationBracket", + 4: "IdentifierKeyword", + 5: "IdentifierOperator", + 6: "Identifier", + 7: "IdentifierBuiltin", + 8: "IdentifierNull", + 9: "IdentifierConstant", + 10: "IdentifierMutableGlobal", + 11: "IdentifierParameter", + 12: "IdentifierLocal", + 13: "IdentifierShadowed", + 14: "IdentifierModule", + 15: "IdentifierFunction", + 16: "IdentifierFunctionDefinition", + 17: "IdentifierMacro", + 18: "IdentifierMacroDefinition", + 19: "IdentifierType", + 20: "IdentifierBuiltinType", + 21: "IdentifierAttribute", + 22: "RegexEscape", + 23: "RegexRepeated", + 24: "RegexWildcard", + 25: "RegexDelimiter", + 26: "RegexJoin", + 27: "StringLiteral", + 28: "StringLiteralEscape", + 29: "StringLiteralSpecial", + 30: "StringLiteralKey", + 31: "CharacterLiteral", + 32: "NumericLiteral", + 33: "BooleanLiteral", + 34: "Tag", + 35: "TagAttribute", + 36: "TagDelimiter", } SyntaxKind_value = map[string]int32{ - "UnspecifiedSyntaxKind": 0, - "Operator": 1, - "Comment": 2, - "PunctuationDelimiter": 3, - "PunctuationBracket": 4, - "PunctuationSpecial": 5, - "Keyword": 6, - "Identifier": 7, - "BuiltinIdentifier": 8, - "NullIdentifier": 9, - "ConstantIdentifier": 10, - "MutableGlobalIdentifier": 11, - "ParameterIdentifier": 12, - "LocalIdentifier": 13, - "ShadowedIdentifier": 14, - "ModuleIdentifier": 15, - "MacroIdentifier": 16, - "StringLiteral": 17, - "StringLiteralRegex": 18, - "StringLiteralEscape": 19, - "StringLiteralSpecial": 20, - "StringLiteralKey": 21, - "CharacterLiteral": 22, - "NumericLiteral": 23, - "BooleanLiteral": 24, - "FunctionDefinition": 25, - "MacroDefinition": 26, - "TypeIdentifier": 27, - "BuiltinTypeIdentifier": 28, - "AttributeIdentifier": 29, - "Tag": 30, - "TagAttribute": 31, - "TagDelimiter": 32, + "UnspecifiedSyntaxKind": 0, + "Comment": 1, + "PunctuationDelimiter": 2, + "PunctuationBracket": 3, + "IdentifierKeyword": 4, + "IdentifierOperator": 5, + "Identifier": 6, + "IdentifierBuiltin": 7, + "IdentifierNull": 8, + "IdentifierConstant": 9, + "IdentifierMutableGlobal": 10, + "IdentifierParameter": 11, + "IdentifierLocal": 12, + "IdentifierShadowed": 13, + "IdentifierModule": 14, + "IdentifierFunction": 15, + "IdentifierFunctionDefinition": 16, + "IdentifierMacro": 17, + "IdentifierMacroDefinition": 18, + "IdentifierType": 19, + "IdentifierBuiltinType": 20, + "IdentifierAttribute": 21, + "RegexEscape": 22, + "RegexRepeated": 23, + "RegexWildcard": 24, + "RegexDelimiter": 25, + "RegexJoin": 26, + "StringLiteral": 27, + "StringLiteralEscape": 28, + "StringLiteralSpecial": 29, + "StringLiteralKey": 30, + "CharacterLiteral": 31, + "NumericLiteral": 32, + "BooleanLiteral": 33, + "Tag": 34, + "TagAttribute": 35, + "TagDelimiter": 36, } ) @@ -1585,67 +1596,73 @@ var file_lib_codeintel_lsiftyped_lsif_proto_rawDesc = []byte{ 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x65, 0x61, 0x64, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x08, 0x12, 0x0d, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x10, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, - 0x10, 0x20, 0x2a, 0xce, 0x05, 0x0a, 0x0a, 0x53, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x4b, 0x69, 0x6e, + 0x10, 0x20, 0x2a, 0xb8, 0x06, 0x0a, 0x0a, 0x53, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, - 0x53, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x4b, 0x69, 0x6e, 0x64, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, - 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x6f, - 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x75, 0x6e, 0x63, 0x74, - 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x10, - 0x03, 0x12, 0x16, 0x0a, 0x12, 0x50, 0x75, 0x6e, 0x63, 0x74, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x42, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x10, 0x04, 0x12, 0x16, 0x0a, 0x12, 0x50, 0x75, 0x6e, - 0x63, 0x74, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x70, 0x65, 0x63, 0x69, 0x61, 0x6c, 0x10, - 0x05, 0x12, 0x0b, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x10, 0x06, 0x12, 0x0e, - 0x0a, 0x0a, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x10, 0x07, 0x12, 0x15, - 0x0a, 0x11, 0x42, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x10, 0x08, 0x12, 0x12, 0x0a, 0x0e, 0x4e, 0x75, 0x6c, 0x6c, 0x49, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x10, 0x09, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x6f, 0x6e, - 0x73, 0x74, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x10, - 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x47, 0x6c, 0x6f, 0x62, - 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x10, 0x0b, 0x12, 0x17, - 0x0a, 0x13, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x49, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x10, 0x0c, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x6f, 0x63, 0x61, 0x6c, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x10, 0x0d, 0x12, 0x16, 0x0a, 0x12, - 0x53, 0x68, 0x61, 0x64, 0x6f, 0x77, 0x65, 0x64, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x10, 0x0e, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x49, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x10, 0x0f, 0x12, 0x13, 0x0a, 0x0f, 0x4d, 0x61, - 0x63, 0x72, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x10, 0x10, 0x12, - 0x11, 0x0a, 0x0d, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, - 0x10, 0x11, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x74, 0x65, - 0x72, 0x61, 0x6c, 0x52, 0x65, 0x67, 0x65, 0x78, 0x10, 0x12, 0x12, 0x17, 0x0a, 0x13, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x45, 0x73, 0x63, 0x61, 0x70, - 0x65, 0x10, 0x13, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x74, - 0x65, 0x72, 0x61, 0x6c, 0x53, 0x70, 0x65, 0x63, 0x69, 0x61, 0x6c, 0x10, 0x14, 0x12, 0x14, 0x0a, - 0x10, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x4b, 0x65, - 0x79, 0x10, 0x15, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, - 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x10, 0x16, 0x12, 0x12, 0x0a, 0x0e, 0x4e, 0x75, 0x6d, - 0x65, 0x72, 0x69, 0x63, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x10, 0x17, 0x12, 0x12, 0x0a, - 0x0e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x10, - 0x18, 0x12, 0x16, 0x0a, 0x12, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, - 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x19, 0x12, 0x13, 0x0a, 0x0f, 0x4d, 0x61, 0x63, - 0x72, 0x6f, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x1a, 0x12, 0x12, - 0x0a, 0x0e, 0x54, 0x79, 0x70, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, - 0x10, 0x1b, 0x12, 0x19, 0x0a, 0x15, 0x42, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x54, 0x79, 0x70, - 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x10, 0x1c, 0x12, 0x17, 0x0a, - 0x13, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x10, 0x1d, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x61, 0x67, 0x10, 0x1e, 0x12, - 0x10, 0x0a, 0x0c, 0x54, 0x61, 0x67, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x10, - 0x1f, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x61, 0x67, 0x44, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, - 0x72, 0x10, 0x20, 0x2a, 0x56, 0x0a, 0x08, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, - 0x17, 0x0a, 0x13, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x53, 0x65, - 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, - 0x72, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x10, 0x02, - 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x10, - 0x03, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x69, 0x6e, 0x74, 0x10, 0x04, 0x2a, 0x4e, 0x0a, 0x0d, 0x44, - 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x1c, 0x0a, 0x18, - 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x44, 0x69, 0x61, 0x67, 0x6e, - 0x6f, 0x73, 0x74, 0x69, 0x63, 0x54, 0x61, 0x67, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x6e, - 0x6e, 0x65, 0x63, 0x65, 0x73, 0x73, 0x61, 0x72, 0x79, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x44, - 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x10, 0x02, 0x42, 0x3d, 0x5a, 0x3b, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x67, 0x72, 0x61, 0x70, 0x68, 0x2f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x67, 0x72, 0x61, 0x70, - 0x68, 0x2f, 0x6c, 0x69, 0x62, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x69, 0x6e, 0x74, 0x65, 0x6c, 0x2f, - 0x6c, 0x73, 0x69, 0x66, 0x74, 0x79, 0x70, 0x65, 0x64, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x53, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x4b, 0x69, 0x6e, 0x64, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, + 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x75, 0x6e, + 0x63, 0x74, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, + 0x72, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x50, 0x75, 0x6e, 0x63, 0x74, 0x75, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x42, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, + 0x10, 0x04, 0x12, 0x16, 0x0a, 0x12, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x10, 0x05, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x10, 0x06, 0x12, 0x15, 0x0a, 0x11, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x42, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x10, + 0x07, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4e, + 0x75, 0x6c, 0x6c, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x10, 0x09, 0x12, 0x1b, 0x0a, + 0x17, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4d, 0x75, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x10, 0x0a, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x10, 0x0b, 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x10, 0x0c, 0x12, 0x16, 0x0a, 0x12, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x53, 0x68, 0x61, 0x64, 0x6f, 0x77, 0x65, 0x64, 0x10, 0x0d, + 0x12, 0x14, 0x0a, 0x10, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x10, 0x0e, 0x12, 0x16, 0x0a, 0x12, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x0f, 0x12, 0x20, + 0x0a, 0x1c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x46, 0x75, 0x6e, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x10, + 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4d, 0x61, + 0x63, 0x72, 0x6f, 0x10, 0x11, 0x12, 0x1d, 0x0a, 0x19, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x4d, 0x61, 0x63, 0x72, 0x6f, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x10, 0x12, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, + 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x10, 0x13, 0x12, 0x19, 0x0a, 0x15, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x42, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x54, 0x79, 0x70, + 0x65, 0x10, 0x14, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x10, 0x15, 0x12, 0x0f, 0x0a, 0x0b, + 0x52, 0x65, 0x67, 0x65, 0x78, 0x45, 0x73, 0x63, 0x61, 0x70, 0x65, 0x10, 0x16, 0x12, 0x11, 0x0a, + 0x0d, 0x52, 0x65, 0x67, 0x65, 0x78, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x10, 0x17, + 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x65, 0x67, 0x65, 0x78, 0x57, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, + 0x64, 0x10, 0x18, 0x12, 0x12, 0x0a, 0x0e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x44, 0x65, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x65, 0x72, 0x10, 0x19, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x65, 0x67, 0x65, 0x78, + 0x4a, 0x6f, 0x69, 0x6e, 0x10, 0x1a, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x10, 0x1b, 0x12, 0x17, 0x0a, 0x13, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x45, 0x73, 0x63, 0x61, 0x70, 0x65, + 0x10, 0x1c, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x74, 0x65, + 0x72, 0x61, 0x6c, 0x53, 0x70, 0x65, 0x63, 0x69, 0x61, 0x6c, 0x10, 0x1d, 0x12, 0x14, 0x0a, 0x10, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x4b, 0x65, 0x79, + 0x10, 0x1e, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x4c, + 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x10, 0x1f, 0x12, 0x12, 0x0a, 0x0e, 0x4e, 0x75, 0x6d, 0x65, + 0x72, 0x69, 0x63, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x10, 0x20, 0x12, 0x12, 0x0a, 0x0e, + 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x10, 0x21, + 0x12, 0x07, 0x0a, 0x03, 0x54, 0x61, 0x67, 0x10, 0x22, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x61, 0x67, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x10, 0x23, 0x12, 0x10, 0x0a, 0x0c, 0x54, + 0x61, 0x67, 0x44, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x10, 0x24, 0x2a, 0x56, 0x0a, + 0x08, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x6e, 0x73, + 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, + 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x0b, 0x0a, + 0x07, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x6e, + 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x48, + 0x69, 0x6e, 0x74, 0x10, 0x04, 0x2a, 0x4e, 0x0a, 0x0d, 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, + 0x74, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x1c, 0x0a, 0x18, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, + 0x69, 0x66, 0x69, 0x65, 0x64, 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x54, + 0x61, 0x67, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x6e, 0x6e, 0x65, 0x63, 0x65, 0x73, 0x73, + 0x61, 0x72, 0x79, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x10, 0x02, 0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2f, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2f, 0x6c, 0x69, 0x62, 0x2f, + 0x63, 0x6f, 0x64, 0x65, 0x69, 0x6e, 0x74, 0x65, 0x6c, 0x2f, 0x6c, 0x73, 0x69, 0x66, 0x74, 0x79, + 0x70, 0x65, 0x64, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/lib/codeintel/lsiftyped/lsif.ts b/lib/codeintel/lsiftyped/lsif.ts index 192eba59f197..edaff58fef06 100644 --- a/lib/codeintel/lsiftyped/lsif.ts +++ b/lib/codeintel/lsiftyped/lsif.ts @@ -25,38 +25,42 @@ export namespace lib.codeintel.lsiftyped { } export enum SyntaxKind { UnspecifiedSyntaxKind = 0, - Operator = 1, - Comment = 2, - PunctuationDelimiter = 3, - PunctuationBracket = 4, - PunctuationSpecial = 5, - Keyword = 6, - Identifier = 7, - BuiltinIdentifier = 8, - NullIdentifier = 9, - ConstantIdentifier = 10, - MutableGlobalIdentifier = 11, - ParameterIdentifier = 12, - LocalIdentifier = 13, - ShadowedIdentifier = 14, - ModuleIdentifier = 15, - MacroIdentifier = 16, - StringLiteral = 17, - StringLiteralRegex = 18, - StringLiteralEscape = 19, - StringLiteralSpecial = 20, - StringLiteralKey = 21, - CharacterLiteral = 22, - NumericLiteral = 23, - BooleanLiteral = 24, - FunctionDefinition = 25, - MacroDefinition = 26, - TypeIdentifier = 27, - BuiltinTypeIdentifier = 28, - AttributeIdentifier = 29, - Tag = 30, - TagAttribute = 31, - TagDelimiter = 32 + Comment = 1, + PunctuationDelimiter = 2, + PunctuationBracket = 3, + IdentifierKeyword = 4, + IdentifierOperator = 5, + Identifier = 6, + IdentifierBuiltin = 7, + IdentifierNull = 8, + IdentifierConstant = 9, + IdentifierMutableGlobal = 10, + IdentifierParameter = 11, + IdentifierLocal = 12, + IdentifierShadowed = 13, + IdentifierModule = 14, + IdentifierFunction = 15, + IdentifierFunctionDefinition = 16, + IdentifierMacro = 17, + IdentifierMacroDefinition = 18, + IdentifierType = 19, + IdentifierBuiltinType = 20, + IdentifierAttribute = 21, + RegexEscape = 22, + RegexRepeated = 23, + RegexWildcard = 24, + RegexDelimiter = 25, + RegexJoin = 26, + StringLiteral = 27, + StringLiteralEscape = 28, + StringLiteralSpecial = 29, + StringLiteralKey = 30, + CharacterLiteral = 31, + NumericLiteral = 32, + BooleanLiteral = 33, + Tag = 34, + TagAttribute = 35, + TagDelimiter = 36 } export enum Severity { UnspecifiedSeverity = 0, diff --git a/proto/lib/codeintel/lsiftyped/lsif.proto b/proto/lib/codeintel/lsiftyped/lsif.proto index e2c9f35f0718..4d214a226ef7 100644 --- a/proto/lib/codeintel/lsiftyped/lsif.proto +++ b/proto/lib/codeintel/lsiftyped/lsif.proto @@ -216,84 +216,89 @@ enum SymbolRole { enum SyntaxKind { UnspecifiedSyntaxKind = 0; - // `+`, `*`, etc. - Operator = 1; - // Comment, including comment markers and text - Comment = 2; + Comment = 1; // `;` `.` `,` - PunctuationDelimiter = 3; + PunctuationDelimiter = 2; // (), {}, [] when used syntactically - PunctuationBracket = 4; - // `{}` within a string. - PunctuationSpecial = 5; + PunctuationBracket = 3; // `if`, `else`, `return`, `class`, etc. - Keyword = 6; + IdentifierKeyword = 4; + + // `+`, `*`, etc. + IdentifierOperator = 5; - // non-specific variables, function calls, etc. - // In general, prefer more specific identifier kinds if possible. - Identifier = 7; + // non-specific catch-all for any identifier not better described elsewhere + Identifier = 6; // Identifiers builtin to the language: `min`, `print` in Python. - BuiltinIdentifier = 8; - // Identifiers builtin to the language: `None` in Python, `nil` in Go. - NullIdentifier = 9; + IdentifierBuiltin = 7; + // Identifiers representing `null`-like values: `None` in Python, `nil` in Go. + IdentifierNull = 8; // `xyz` in `const xyz = "hello"` - ConstantIdentifier = 10; + IdentifierConstant = 9; // `var X = "hello"` in Go - MutableGlobalIdentifier = 11; + IdentifierMutableGlobal = 10; // both parameter definition and references - ParameterIdentifier = 12; + IdentifierParameter = 11; // identifiers for variable definitions and references within a local scope - LocalIdentifier = 13; + IdentifierLocal = 12; // Used when identifier shadowes some other identifier within the scope - ShadowedIdentifier = 14; + IdentifierShadowed = 13; // `package main` - ModuleIdentifier = 15; - // Macro references only, not definitions - MacroIdentifier = 16; + IdentifierModule = 14; - // Literal strings: "Hello, world!" - StringLiteral = 17; - // ".*" in a string regex - StringLiteralRegex = 18; - // "\t", "\n" - StringLiteralEscape = 19; - // datetimes within strings, special words within a string - StringLiteralSpecial = 20; - // "key" in { "key": "value" } - StringLiteralKey = 21; - // 'c' or similar, in languages that differentiate strings and characters - CharacterLiteral = 22; - // Literal numbers, both floats and integers - NumericLiteral = 23; - // `true`, `false` - BooleanLiteral = 24; + // Function call/reference + IdentifierFunction = 15; + // Function definition only + IdentifierFunctionDefinition = 16; - // Function definition only. - // Included because many editors highlight a function definition differently - // from function calls. - FunctionDefinition = 25; - // Macro definition only. - // Included because many editors highlight a macro definition differently - // from macro usages. - MacroDefinition = 26; + // Macro call/reference + IdentifierMacro = 17; + // Macro definition only + IdentifierMacroDefinition = 18; // non-builtin types, including namespaces - TypeIdentifier = 27; + IdentifierType = 19; // builtin types only, such as `str` for Python or `int` in Go - BuiltinTypeIdentifier = 28; + IdentifierBuiltinType = 20; // Python decorators, c-like __attribute__ - AttributeIdentifier = 29; + IdentifierAttribute = 21; + + // `\b` + RegexEscape = 22; + // `*`, `+` + RegexRepeated = 23; + // `.` + RegexWildcard = 24; + // `(`, `)`, `[`, `]` + RegexDelimiter = 25; + // `|`, `-` + RegexJoin = 26; + + // Literal strings: "Hello, world!" + StringLiteral = 27; + // non-regex escapes: "\t", "\n" + StringLiteralEscape = 28; + // datetimes within strings, special words within a string, `{}` in format strings + StringLiteralSpecial = 29; + // "key" in { "key": "value" }, useful for example in JSON + StringLiteralKey = 30; + // 'c' or similar, in languages that differentiate strings and characters + CharacterLiteral = 31; + // Literal numbers, both floats and integers + NumericLiteral = 32; + // `true`, `false` + BooleanLiteral = 33; // Used for XML-like tags - Tag = 30; + Tag = 34; // Attribute name in XML-like tags - TagAttribute = 31; + TagAttribute = 35; // Delimiters for XML-like tags - TagDelimiter = 32; + TagDelimiter = 36; } // Occurrence associates a source position with a symbol and/or highlighting diff --git a/schema/schema.go b/schema/schema.go index 176c0f441493..87e09e98cb3d 100644 --- a/schema/schema.go +++ b/schema/schema.go @@ -1617,6 +1617,8 @@ type SettingsExperimentalFeatures struct { ShowSearchContextManagement *bool `json:"showSearchContextManagement,omitempty"` // ShowSearchNotebook description: Enables the search notebook at search/notebook ShowSearchNotebook *bool `json:"showSearchNotebook,omitempty"` + // TreeSitterEnabled description: Enables tree sitter for enabled filetypes + TreeSitterEnabled *bool `json:"treeSitterEnabled,omitempty"` } // SiteConfiguration description: Configuration for a Sourcegraph site. diff --git a/schema/settings.schema.json b/schema/settings.schema.json index 383362e1db5a..c557c2800827 100644 --- a/schema/settings.schema.json +++ b/schema/settings.schema.json @@ -198,6 +198,14 @@ "pointer": true } }, + "treeSitterEnabled": { + "description": "Enables tree sitter for enabled filetypes", + "type": "boolean", + "default": false, + "!go": { + "pointer": true + } + }, "batchChangesExecution": { "description": "Enables/disables the Batch Changes server side execution feature.", "type": "boolean",