Skip to content

Commit

Permalink
fix: Fix eslint errors
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Tao <[email protected]>
  • Loading branch information
tcx4c70 committed Nov 23, 2024
1 parent 2e19ab2 commit f437ae6
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/language-client/utils/codeConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ export interface URIConverter {
}

export function createConverter(uriConverter?: URIConverter): Converter {
uriConverter = uriConverter || ((value: URI) => value.toString());
uriConverter = uriConverter || ((value: URI) => value.toString())

function asUri(value: URI | DocumentUri): string {
if (URI.isUri(value)) {
return uriConverter(value);
return uriConverter(value)
} else {
return uriConverter(URI.parse(value));
return uriConverter(URI.parse(value))
}
}

Expand Down Expand Up @@ -103,29 +103,27 @@ export function createConverter(uriConverter?: URIConverter): Converter {
return result
}


function asFullChangeTextDocumentParams(textDocument: TextDocument): protocol.DidChangeTextDocumentParams {
return {
textDocument: asVersionedTextDocumentIdentifier(textDocument),
contentChanges: [{ text: textDocument.getText() }]
}
}


function asCloseTextDocumentParams(textDocument: TextDocument): protocol.DidCloseTextDocumentParams {
return {
textDocument: asTextDocumentIdentifier(textDocument)
}
}

function asSaveTextDocumentParams(textDocument: TextDocument, includeText: boolean = false): protocol.DidSaveTextDocumentParams {
function asSaveTextDocumentParams(textDocument: TextDocument, includeText = false): protocol.DidSaveTextDocumentParams {
let result: protocol.DidSaveTextDocumentParams = {
textDocument: asVersionedTextDocumentIdentifier(textDocument)
}
if (includeText) {
result.text = textDocument.getText();
result.text = textDocument.getText()
}
return result;
return result
}

function asWillSaveTextDocumentParams(event: TextDocumentWillSaveEvent): protocol.WillSaveTextDocumentParams {
Expand Down Expand Up @@ -175,30 +173,30 @@ export function createConverter(uriConverter?: URIConverter): Converter {
function asTextDocumentPositionParams(textDocument: TextDocument, position: Position): protocol.TextDocumentPositionParams {
return {
textDocument: asTextDocumentIdentifier(textDocument),
position: position
position
}
}

function asCompletionParams(textDocument: TextDocument, position: Position, context: protocol.CompletionContext): protocol.CompletionParams {
return {
textDocument: asTextDocumentIdentifier(textDocument),
position: position,
position,
context: omit(context, ['option'])
}
}

function asSignatureHelpParams(textDocument: TextDocument, position: Position, context: protocol.SignatureHelpContext): protocol.SignatureHelpParams {
return {
textDocument: asTextDocumentIdentifier(textDocument),
position: position,
context: context
position,
context
}
}

function asReferenceParams(textDocument: TextDocument, position: Position, options: { includeDeclaration: boolean }): protocol.ReferenceParams {
return {
textDocument: asTextDocumentIdentifier(textDocument),
position: position,
position,
context: { includeDeclaration: options.includeDeclaration }
}
}
Expand Down

0 comments on commit f437ae6

Please sign in to comment.