1
0
mirror of https://github.com/golang/go synced 2024-11-18 08:54:45 -07:00

internal/lsp: bring lsp protocol stubs up to date

The only substantial change is data types for CallHeirarchy.

util.ts has changed the hash, and adapted to a new source layout, plus
the usual pointless whitespace changes. code.ts has learned a little more
about typescript ASTs.

Change-Id: I9cb3a9a9034d46f4a479123779da3bb3474e4a42
Reviewed-on: https://go-review.googlesource.com/c/tools/+/237377
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
pjw 2020-06-10 11:16:20 -04:00 committed by Peter Weinberger
parent 40866c6c36
commit 99be2d6e79
5 changed files with 173 additions and 94 deletions

View File

@ -2,8 +2,8 @@ package protocol
// Package protocol contains data types and code for LSP jsonrpcs
// generated automatically from vscode-languageserver-node
// commit: 151b520c995ee3d76729b5c46258ab273d989726
// last fetched Mon Mar 30 2020 21:01:17 GMT-0400 (Eastern Daylight Time)
// commit: 1f688e2f65f3a6fc9ba395380cd7b059667a9ecf
// last fetched Tue Jun 09 2020 11:22:02 GMT-0400 (Eastern Daylight Time)
// Code generated (see typescript/README.md) DO NOT EDIT.

View File

@ -1,7 +1,7 @@
// Package protocol contains data types and code for LSP jsonrpcs
// generated automatically from vscode-languageserver-node
// commit: 151b520c995ee3d76729b5c46258ab273d989726
// last fetched Mon Mar 30 2020 21:01:17 GMT-0400 (Eastern Daylight Time)
// commit: 1f688e2f65f3a6fc9ba395380cd7b059667a9ecf
// last fetched Tue Jun 09 2020 11:22:02 GMT-0400 (Eastern Daylight Time)
package protocol
// Code generated (see typescript/README.md) DO NOT EDIT.
@ -44,10 +44,22 @@ type ApplyWorkspaceEditResponse struct {
FailedChange float64 `json:"failedChange,omitempty"`
}
/**
* @since 3.16.0
*/
type CallHierarchyClientCapabilities struct {
/**
* Whether implementation supports dynamic registration. If this is set to `true`
* the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
* return value for the corresponding server capability as well.
*/
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
/**
* Represents an incoming call, e.g. a caller of a method or constructor.
*
* @since 3.16.0 - Proposed state
* @since 3.16.0
*/
type CallHierarchyIncomingCall struct {
/**
@ -55,7 +67,7 @@ type CallHierarchyIncomingCall struct {
*/
From CallHierarchyItem `json:"from"`
/**
* The range at which at which the calls appears. This is relative to the caller
* The ranges at which the calls appear. This is relative to the caller
* denoted by [`this.from`](#CallHierarchyIncomingCall.from).
*/
FromRanges []Range `json:"fromRanges"`
@ -64,7 +76,7 @@ type CallHierarchyIncomingCall struct {
/**
* The parameter of a `callHierarchy/incomingCalls` request.
*
* @since 3.16.0 - Proposed state
* @since 3.16.0
*/
type CallHierarchyIncomingCallsParams struct {
Item CallHierarchyItem `json:"item"`
@ -76,7 +88,7 @@ type CallHierarchyIncomingCallsParams struct {
* Represents programming constructs like functions or constructors in the context
* of call hierarchy.
*
* @since 3.16.0 - Proposed state
* @since 3.16.0
*/
type CallHierarchyItem struct {
/**
@ -110,10 +122,19 @@ type CallHierarchyItem struct {
SelectionRange Range `json:"selectionRange"`
}
/**
* Call hierarchy options used during static registration.
*
* @since 3.16.0
*/
type CallHierarchyOptions struct {
WorkDoneProgressOptions
}
/**
* Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.
*
* @since 3.16.0 - Proposed state
* @since 3.16.0
*/
type CallHierarchyOutgoingCall struct {
/**
@ -131,7 +152,7 @@ type CallHierarchyOutgoingCall struct {
/**
* The parameter of a `callHierarchy/outgoingCalls` request.
*
* @since 3.16.0 - Proposed state
* @since 3.16.0
*/
type CallHierarchyOutgoingCallsParams struct {
Item CallHierarchyItem `json:"item"`
@ -142,13 +163,24 @@ type CallHierarchyOutgoingCallsParams struct {
/**
* The parameter of a `textDocument/prepareCallHierarchy` request.
*
* @since 3.16.0 - Proposed state
* @since 3.16.0
*/
type CallHierarchyPrepareParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
}
/**
* Call hierarchy options used during static or dynamic registration.
*
* @since 3.16.0
*/
type CallHierarchyRegistrationOptions struct {
TextDocumentRegistrationOptions
CallHierarchyOptions
StaticRegistrationOptions
}
type CancelParams struct {
/**
* The request id to cancel.
@ -250,8 +282,9 @@ type CodeActionClientCapabilities struct {
*/
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
/**
* The client support code action literals as a valid
* response of the `textDocument/codeAction` request.
* The client support code action literals of type `CodeAction` as a valid
* response of the `textDocument/codeAction` request. If the property is not
* set the request can only return `Command` literals.
*
* @since 3.8.0
*/
@ -669,8 +702,16 @@ type CompletionItem struct {
* this completion. When an edit is provided the value of
* [insertText](#CompletionItem.insertText) is ignored.
*
* *Note:* The text edit's range as well as both ranges from a insert replace edit must be a
* Most editors support two different operation when accepting a completion item. One is to insert a
* completion text and the other is to replace an existing text with a competion text. Since this can
* usually not predetermend by a server it can report both ranges. Clients need to signal support for
* `InsertReplaceEdits` via the `textDocument.completion.insertReplaceSupport` client capability
* property.
*
* *Note 1:* The text edit's range as well as both ranges from a insert replace edit must be a
* [single line] and they must contain the position at which completion has been requested.
* *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range must be a prefix of
* the edit's replace range, that means it must be contained and starting at the same position.
*
* @since 3.16.0 additional type `InsertReplaceEdit` - Proposed state
*/
@ -2061,6 +2102,10 @@ type InnerServerCapabilities struct {
* The server provides execute command support.
*/
ExecuteCommandProvider ExecuteCommandOptions `json:"executeCommandProvider,omitempty"`
/**
* The server provides Call Hierarchy support.
*/
CallHierarchyProvider interface{}/* bool | CallHierarchyOptions | CallHierarchyRegistrationOptions*/ `json:"callHierarchyProvider,omitempty"`
/**
* Experimental server capabilities.
*/
@ -2068,7 +2113,7 @@ type InnerServerCapabilities struct {
}
/**
* A special text edit to provide a insert or a replace operation.
* A special text edit to provide an insert and a replace operation.
*
* @since 3.16.0 - Proposed state
*/
@ -2614,9 +2659,18 @@ type SemanticTokens struct {
* @since 3.16.0 - Proposed state
*/
type SemanticTokensEdit struct {
Start float64 `json:"start"`
DeleteCount float64 `json:"deleteCount"`
Data []float64 `json:"data,omitempty"`
/**
* The start offset of the edit.
*/
Start float64 `json:"start"`
/**
* The count of elements to remove.
*/
DeleteCount float64 `json:"deleteCount"`
/**
* The elements to insert.
*/
Data []float64 `json:"data,omitempty"`
}
/**
@ -2773,6 +2827,10 @@ type ServerCapabilities = struct {
* The server provides execute command support.
*/
ExecuteCommandProvider ExecuteCommandOptions `json:"executeCommandProvider,omitempty"`
/**
* The server provides Call Hierarchy support.
*/
CallHierarchyProvider interface{}/* bool | CallHierarchyOptions | CallHierarchyRegistrationOptions*/ `json:"callHierarchyProvider,omitempty"`
/**
* Experimental server capabilities.
*/
@ -2868,6 +2926,13 @@ type SignatureHelpClientCapabilities struct {
*/
LabelOffsetSupport bool `json:"labelOffsetSupport,omitempty"`
} `json:"parameterInformation,omitempty"`
/**
* The client support the `activeParameter` property on `SignatureInformation`
* literal.
*
* @since 3.16.0 - proposed state
*/
ActiveParameterSupport bool `json:"activeParameterSupport,omitempty"`
} `json:"signatureInformation,omitempty"`
/**
* The client supports to send additional context information for a
@ -2974,6 +3039,14 @@ type SignatureInformation struct {
* The parameters of this signature.
*/
Parameters []ParameterInformation `json:"parameters,omitempty"`
/**
* The index of the active parameter.
*
* If provided, this is used in place of `SignatureHelp.activeParameter`.
*
* @since 3.16.0 - proposed state
*/
ActiveParameter float64 `json:"activeParameter,omitempty"`
}
/**
@ -3147,6 +3220,12 @@ type TextDocumentClientCapabilities struct {
* Capabilities specific to `textDocument/publishDiagnostics`.
*/
PublishDiagnostics PublishDiagnosticsClientCapabilities `json:"publishDiagnostics,omitempty"`
/**
* Capabilities specific to the `textDocument/callHierarchy`.
*
* @since 3.16.0
*/
CallHierarchy CallHierarchyClientCapabilities `json:"callHierarchy,omitempty"`
}
/**
@ -3304,7 +3383,7 @@ type TextDocumentSyncOptions struct {
* If present save notifications are sent to the server. If omitted the notification should not be
* sent.
*/
Save SaveOptions `json:"save,omitempty"`
Save SaveOptions/*boolean | SaveOptions*/ `json:"save,omitempty"`
}
/**
@ -3502,11 +3581,10 @@ type WorkDoneProgressParams struct {
type WorkDoneProgressReport struct {
Kind string `json:"kind"`
/**
* Controls enablement state of a cancel button. This property is only valid if a cancel
* button got requested in the `WorkDoneProgressStart` payload.
* Controls enablement state of a cancel button.
*
* Clients that don't support cancellation or don't support control the button's
* enablement state are allowed to ignore the setting.
* Clients that don't support cancellation or don't support controlling the button's
* enablement state are allowed to ignore the property.
*/
Cancellable bool `json:"cancellable,omitempty"`
/**
@ -3957,7 +4035,7 @@ const (
* the end of the snippet. Placeholders with equal identifiers are linked,
* that is typing in one will update others too.
*
* See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
* See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
*/
SnippetTextFormat InsertTextFormat = 2

View File

@ -2,8 +2,8 @@ package protocol
// Package protocol contains data types and code for LSP jsonrpcs
// generated automatically from vscode-languageserver-node
// commit: 151b520c995ee3d76729b5c46258ab273d989726
// last fetched Mon Mar 30 2020 21:01:17 GMT-0400 (Eastern Daylight Time)
// commit: 1f688e2f65f3a6fc9ba395380cd7b059667a9ecf
// last fetched Tue Jun 09 2020 11:22:02 GMT-0400 (Eastern Daylight Time)
// Code generated (see typescript/README.md) DO NOT EDIT.
@ -36,6 +36,9 @@ type Server interface {
FoldingRange(context.Context, *FoldingRangeParams) ([]FoldingRange /*FoldingRange[] | null*/, error)
Declaration(context.Context, *DeclarationParams) (Declaration /*Declaration | DeclarationLink[] | null*/, error)
SelectionRange(context.Context, *SelectionRangeParams) ([]SelectionRange /*SelectionRange[] | null*/, error)
PrepareCallHierarchy(context.Context, *CallHierarchyPrepareParams) ([]CallHierarchyItem /*CallHierarchyItem[] | null*/, error)
IncomingCalls(context.Context, *CallHierarchyIncomingCallsParams) ([]CallHierarchyIncomingCall /*CallHierarchyIncomingCall[] | null*/, error)
OutgoingCalls(context.Context, *CallHierarchyOutgoingCallsParams) ([]CallHierarchyOutgoingCall /*CallHierarchyOutgoingCall[] | null*/, error)
Initialize(context.Context, *ParamInitialize) (*InitializeResult, error)
Shutdown(context.Context) error
WillSaveWaitUntil(context.Context, *WillSaveTextDocumentParams) ([]TextEdit /*TextEdit[] | null*/, error)
@ -59,9 +62,6 @@ type Server interface {
Rename(context.Context, *RenameParams) (*WorkspaceEdit /*WorkspaceEdit | null*/, error)
PrepareRename(context.Context, *PrepareRenameParams) (*Range /*Range | { range: Range, placeholder: string } | null*/, error)
ExecuteCommand(context.Context, *ExecuteCommandParams) (interface{} /*any | null*/, error)
PrepareCallHierarchy(context.Context, *CallHierarchyPrepareParams) ([]CallHierarchyItem /*CallHierarchyItem[] | null*/, error)
IncomingCalls(context.Context, *CallHierarchyIncomingCallsParams) ([]CallHierarchyIncomingCall /*CallHierarchyIncomingCall[] | null*/, error)
OutgoingCalls(context.Context, *CallHierarchyOutgoingCallsParams) ([]CallHierarchyOutgoingCall /*CallHierarchyOutgoingCall[] | null*/, error)
SemanticTokens(context.Context, *SemanticTokensParams) (*SemanticTokens /*SemanticTokens | null*/, error)
SemanticTokensEdits(context.Context, *SemanticTokensEditsParams) (interface{} /* SemanticTokens | SemanticTokensEdits | nil*/, error)
SemanticTokensRange(context.Context, *SemanticTokensRangeParams) (*SemanticTokens /*SemanticTokens | null*/, error)
@ -206,6 +206,27 @@ func serverDispatch(ctx context.Context, server Server, reply jsonrpc2.Replier,
}
resp, err := server.SelectionRange(ctx, &params)
return true, reply(ctx, resp, err)
case "textDocument/prepareCallHierarchy": // req
var params CallHierarchyPrepareParams
if err := json.Unmarshal(r.Params(), &params); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.PrepareCallHierarchy(ctx, &params)
return true, reply(ctx, resp, err)
case "callHierarchy/incomingCalls": // req
var params CallHierarchyIncomingCallsParams
if err := json.Unmarshal(r.Params(), &params); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.IncomingCalls(ctx, &params)
return true, reply(ctx, resp, err)
case "callHierarchy/outgoingCalls": // req
var params CallHierarchyOutgoingCallsParams
if err := json.Unmarshal(r.Params(), &params); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.OutgoingCalls(ctx, &params)
return true, reply(ctx, resp, err)
case "initialize": // req
var params ParamInitialize
if err := json.Unmarshal(r.Params(), &params); err != nil {
@ -366,27 +387,6 @@ func serverDispatch(ctx context.Context, server Server, reply jsonrpc2.Replier,
}
resp, err := server.ExecuteCommand(ctx, &params)
return true, reply(ctx, resp, err)
case "textDocument/prepareCallHierarchy": // req
var params CallHierarchyPrepareParams
if err := json.Unmarshal(r.Params(), &params); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.PrepareCallHierarchy(ctx, &params)
return true, reply(ctx, resp, err)
case "callHierarchy/incomingCalls": // req
var params CallHierarchyIncomingCallsParams
if err := json.Unmarshal(r.Params(), &params); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.IncomingCalls(ctx, &params)
return true, reply(ctx, resp, err)
case "callHierarchy/outgoingCalls": // req
var params CallHierarchyOutgoingCallsParams
if err := json.Unmarshal(r.Params(), &params); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.OutgoingCalls(ctx, &params)
return true, reply(ctx, resp, err)
case "textDocument/semanticTokens": // req
var params SemanticTokensParams
if err := json.Unmarshal(r.Params(), &params); err != nil {
@ -521,6 +521,30 @@ func (s *serverDispatcher) SelectionRange(ctx context.Context, params *Selection
return result, nil
}
func (s *serverDispatcher) PrepareCallHierarchy(ctx context.Context, params *CallHierarchyPrepareParams) ([]CallHierarchyItem /*CallHierarchyItem[] | null*/, error) {
var result []CallHierarchyItem /*CallHierarchyItem[] | null*/
if err := Call(ctx, s.Conn, "textDocument/prepareCallHierarchy", params, &result); err != nil {
return nil, err
}
return result, nil
}
func (s *serverDispatcher) IncomingCalls(ctx context.Context, params *CallHierarchyIncomingCallsParams) ([]CallHierarchyIncomingCall /*CallHierarchyIncomingCall[] | null*/, error) {
var result []CallHierarchyIncomingCall /*CallHierarchyIncomingCall[] | null*/
if err := Call(ctx, s.Conn, "callHierarchy/incomingCalls", params, &result); err != nil {
return nil, err
}
return result, nil
}
func (s *serverDispatcher) OutgoingCalls(ctx context.Context, params *CallHierarchyOutgoingCallsParams) ([]CallHierarchyOutgoingCall /*CallHierarchyOutgoingCall[] | null*/, error) {
var result []CallHierarchyOutgoingCall /*CallHierarchyOutgoingCall[] | null*/
if err := Call(ctx, s.Conn, "callHierarchy/outgoingCalls", params, &result); err != nil {
return nil, err
}
return result, nil
}
func (s *serverDispatcher) Initialize(ctx context.Context, params *ParamInitialize) (*InitializeResult, error) {
var result *InitializeResult
if err := Call(ctx, s.Conn, "initialize", params, &result); err != nil {
@ -701,30 +725,6 @@ func (s *serverDispatcher) ExecuteCommand(ctx context.Context, params *ExecuteCo
return result, nil
}
func (s *serverDispatcher) PrepareCallHierarchy(ctx context.Context, params *CallHierarchyPrepareParams) ([]CallHierarchyItem /*CallHierarchyItem[] | null*/, error) {
var result []CallHierarchyItem /*CallHierarchyItem[] | null*/
if err := Call(ctx, s.Conn, "textDocument/prepareCallHierarchy", params, &result); err != nil {
return nil, err
}
return result, nil
}
func (s *serverDispatcher) IncomingCalls(ctx context.Context, params *CallHierarchyIncomingCallsParams) ([]CallHierarchyIncomingCall /*CallHierarchyIncomingCall[] | null*/, error) {
var result []CallHierarchyIncomingCall /*CallHierarchyIncomingCall[] | null*/
if err := Call(ctx, s.Conn, "callHierarchy/incomingCalls", params, &result); err != nil {
return nil, err
}
return result, nil
}
func (s *serverDispatcher) OutgoingCalls(ctx context.Context, params *CallHierarchyOutgoingCallsParams) ([]CallHierarchyOutgoingCall /*CallHierarchyOutgoingCall[] | null*/, error) {
var result []CallHierarchyOutgoingCall /*CallHierarchyOutgoingCall[] | null*/
if err := Call(ctx, s.Conn, "callHierarchy/outgoingCalls", params, &result); err != nil {
return nil, err
}
return result, nil
}
func (s *serverDispatcher) SemanticTokens(ctx context.Context, params *SemanticTokensParams) (*SemanticTokens /*SemanticTokens | null*/, error) {
var result *SemanticTokens /*SemanticTokens | null*/
if err := Call(ctx, s.Conn, "textDocument/semanticTokens", params, &result); err != nil {

View File

@ -196,7 +196,8 @@ function genTypes(node: ts.Node) {
if (ts.isExpressionStatement(node) || ts.isFunctionDeclaration(node) ||
ts.isImportDeclaration(node) || ts.isVariableStatement(node) ||
ts.isExportDeclaration(node) || ts.isEmptyStatement(node) ||
node.kind == ts.SyntaxKind.EndOfFileToken) {
ts.isExportAssignment(node) || ts.isImportEqualsDeclaration(node) ||
ts.isBlock(node) || node.kind == ts.SyntaxKind.EndOfFileToken) {
return;
}
if (ts.isInterfaceDeclaration(node)) {
@ -214,7 +215,7 @@ function genTypes(node: ts.Node) {
// and InitializeResult: [custom: string]: any;]
return
} else
throw new Error(`unexpected ${strKind(t)}`)
throw new Error(`217 unexpected ${strKind(t)}`)
};
v.members.forEach(f);
if (mems.length == 0 && !v.heritageClauses &&
@ -334,7 +335,7 @@ function genTypes(node: ts.Node) {
throw new Error(`Class dup ${loc(c.me)} and ${loc(data.get(c.name).me)}`);
data.set(c.name, c);
} else {
throw new Error(`unexpected ${strKind(node)} ${loc(node)} `)
throw new Error(`338 unexpected ${strKind(node)} ${loc(node)} `)
}
}
@ -347,8 +348,6 @@ function dataMerge(a: Data, b: Data): Data {
}
const ax = `(${a.statements.length},${a.properties.length})`
const bx = `(${b.statements.length},${b.properties.length})`
// console.log(`397
// ${a.name}${ax}${bx}\n${a.me.getText()}\n${b.me.getText()}\n`)
switch (a.name) {
case 'InitializeError':
case 'MessageType':
@ -358,13 +357,14 @@ function dataMerge(a: Data, b: Data): Data {
// want the Module
return a.statements.length > 0 ? a : b;
case 'CancellationToken':
case 'CancellationStrategy':
// want the Interface
return a.properties.length > 0 ? a : b;
case 'TextDocumentContentChangeEvent': // almost the same
return a;
}
console.log(
`${strKind(a.me)} ${strKind(b.me)} ${a.name} ${loc(a.me)} ${loc(b.me)}`)
`367 ${strKind(a.me)} ${strKind(b.me)} ${a.name} ${loc(a.me)} ${loc(b.me)}`)
throw new Error(`Fix dataMerge for ${a.name}`)
}
@ -676,6 +676,7 @@ function goUnionType(n: ts.UnionTypeNode, nm: string): string {
if (a == 'BooleanKeyword') { // usually want bool
if (nm == 'codeActionProvider') return `interface{} ${help}`;
if (nm == 'renameProvider') return `interface{} ${help}`;
if (nm == 'save') return `${goType(n.types[1], '680')} ${help}`;
return `${goType(n.types[0], 'b')} ${help}`
}
if (b == 'ArrayType') return `${goType(n.types[1], 'c')} ${help}`;
@ -687,7 +688,7 @@ function goUnionType(n: ts.UnionTypeNode, nm: string): string {
if (a == 'TypeLiteral' && nm == 'TextDocumentContentChangeEvent') {
return `${goType(n.types[0], nm)}`
}
throw new Error(`724 ${a} ${b} ${n.getText()} ${loc(n)}`);
throw new Error(`691 ${a} ${b} ${n.getText()} ${loc(n)}`);
case 3:
const aa = strKind(n.types[0])
const bb = strKind(n.types[1])
@ -726,7 +727,7 @@ function goUnionType(n: ts.UnionTypeNode, nm: string): string {
// Result will be interface{} with a comment
let isLiteral = true;
let literal = 'string';
let res = `interface{ } /* `
let res = `interface{} /* `
n.types.forEach((v: ts.TypeNode, i: number) => {
// might get an interface inside:
// (Command | CodeAction)[] | null

View File

@ -10,11 +10,11 @@ import * as ts from 'typescript';
let dir = process.env['HOME'];
const srcDir = '/vscode-languageserver-node'
export const fnames = [
//`${dir}${srcDir}/protocol/src/protocol.ts`, // why isn't this main.ts?
`${dir}/${srcDir}/protocol/src/main.ts`, `${dir}${srcDir}/types/src/main.ts`,
`${dir}${srcDir}/jsonrpc/src/main.ts`
`${dir}${srcDir}/protocol/src/common/protocol.ts`,
`${dir}/${srcDir}/protocol/src/browser/main.ts`, `${dir}${srcDir}/types/src/main.ts`,
`${dir}${srcDir}/jsonrpc/src/node/main.ts`
];
export const gitHash = '151b520c995ee3d76729b5c46258ab273d989726'
export const gitHash = '1f688e2f65f3a6fc9ba395380cd7b059667a9ecf'
let outFname = 'tsprotocol.go';
let fda: number, fdb: number, fde: number; // file descriptors
@ -66,10 +66,10 @@ export function computeHeader(pkgDoc: boolean): string {
}
}
const a =
`// Package protocol contains data types and code for LSP jsonrpcs\n` +
`// generated automatically from vscode-languageserver-node\n` +
`// commit: ${gitHash}\n` +
`// last fetched ${lastDate}\n`
`// Package protocol contains data types and code for LSP jsonrpcs\n` +
`// generated automatically from vscode-languageserver-node\n` +
`// commit: ${gitHash}\n` +
`// last fetched ${lastDate}\n`
const b = 'package protocol\n'
const c = `\n// Code generated (see typescript/README.md) DO NOT EDIT.\n\n`
if (pkgDoc) {
@ -95,7 +95,7 @@ export function goName(s: string): string {
// Generate JSON tag for a struct field
export function JSON(n: ts.PropertySignature): string {
const json = `\`json:"${n.name.getText()}${
n.questionToken != undefined ? ',omitempty' : ''}"\``;
n.questionToken != undefined ? ',omitempty' : ''}"\``;
return json
}
@ -114,7 +114,7 @@ export function constName(nm: string, type: string): string {
let ans = nm;
if (pref.get(type)) ans = pref.get(type) + ans;
if (suff.has(type)) ans = ans + suff.get(type)
return ans
return ans
}
// Find the comments associated with an AST node
@ -193,7 +193,7 @@ export function loc(node: ts.Node): string {
const n = fn.search(/-node./)
fn = fn.substring(n + 6)
return `${fn} ${x.line + 1}: ${x.character + 1} (${y.line + 1}: ${
y.character + 1})`
y.character + 1})`
}
// --- various string stuff
@ -201,7 +201,7 @@ export function loc(node: ts.Node): string {
// as part of printing the AST tree
function kinds(n: ts.Node): string {
let res = 'Seen ' + strKind(n);
function f(n: ts.Node): void{res += ' ' + strKind(n)};
function f(n: ts.Node): void {res += ' ' + strKind(n)};
ts.forEachChild(n, f)
return res
}