-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add lint check * feat: fix lint error
- Loading branch information
Showing
10 changed files
with
178 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,40 @@ | ||
import * as fs from 'fs'; | ||
import * as vscode from 'vscode'; | ||
import * as lc from 'vscode-languageclient'; | ||
|
||
import { CommandFactory } from '.'; | ||
import { IDEExtensionContext } from '../context'; | ||
|
||
/** | ||
* startLanguageServer | ||
*/ | ||
export const startLanguageServer: CommandFactory = (ctx: IDEExtensionContext) => { | ||
return async (): Promise<void> => { | ||
const logger = ctx.logger | ||
|
||
const executable: lc.Executable = { | ||
command: ctx.moveAnalyzerBin || 'move-analyzer', | ||
}; | ||
const serverOptions: lc.ServerOptions = { | ||
run: executable, | ||
debug: executable, | ||
}; | ||
|
||
// The vscode-languageclient module reads a configuration option named | ||
// "<extension-name>.trace.server" to determine whether to log messages. If a trace output | ||
// channel is specified, these messages are printed there, otherwise they appear in the | ||
// output channel that it automatically created by the `LanguageClient` (in this extension, | ||
// that is 'Move Language Server'). For more information, see: | ||
// https://code.visualstudio.com/api/language-extensions/language-server-extension-guide#logging-support-for-language-server | ||
const traceOutputChannel = vscode.window.createOutputChannel( | ||
'Move Analyzer Language Server Trace', | ||
); | ||
const clientOptions: lc.LanguageClientOptions = { | ||
documentSelector: [{ scheme: 'file', language: 'move' }], | ||
traceOutputChannel, | ||
}; | ||
|
||
const client = new lc.LanguageClient( | ||
'move-analyzer', | ||
'Move Language Server', | ||
serverOptions, | ||
clientOptions, | ||
); | ||
logger.info('Starting client...'); | ||
const disposable = client.start(); | ||
ctx.vscode.subscriptions.push(disposable); | ||
ctx.languageClient = client; | ||
}; | ||
}; | ||
import * as vscode from 'vscode'; | ||
import * as lc from 'vscode-languageclient'; | ||
|
||
import { CommandFactory } from '.'; | ||
import { IDEExtensionContext } from '../context'; | ||
|
||
/** | ||
* startLanguageServer | ||
*/ | ||
export const startLanguageServer: CommandFactory = (ctx: IDEExtensionContext) => { | ||
return async (): Promise<void> => { | ||
const logger = ctx.logger; | ||
|
||
const executable: lc.Executable = { | ||
command: ctx.moveAnalyzerBin || 'move-analyzer' | ||
}; | ||
const serverOptions: lc.ServerOptions = { | ||
run: executable, | ||
debug: executable | ||
}; | ||
|
||
// The vscode-languageclient module reads a configuration option named | ||
// "<extension-name>.trace.server" to determine whether to log messages. If a trace output | ||
// channel is specified, these messages are printed there, otherwise they appear in the | ||
// output channel that it automatically created by the `LanguageClient` (in this extension, | ||
// that is 'Move Language Server'). For more information, see: | ||
// https://code.visualstudio.com/api/language-extensions/language-server-extension-guide#logging-support-for-language-server | ||
const traceOutputChannel = vscode.window.createOutputChannel('Move Analyzer Language Server Trace'); | ||
const clientOptions: lc.LanguageClientOptions = { | ||
documentSelector: [{ scheme: 'file', language: 'move' }], | ||
traceOutputChannel | ||
}; | ||
|
||
const client = new lc.LanguageClient('move-analyzer', 'Move Language Server', serverOptions, clientOptions); | ||
logger.info('Starting client...'); | ||
const disposable = client.start(); | ||
ctx.vscode.subscriptions.push(disposable); | ||
ctx.languageClient = client; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
// Copyright (c) The Diem Core Contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import * as vscode from 'vscode'; | ||
|
||
/** | ||
* A logger for the VS Code extension. | ||
* | ||
* Messages that are logged appear in an output channel created below that is dedicated to the | ||
* extension (or "client"), in the extension user's "Output View." This logger should be used for | ||
* messages related to VS Code and this extension, as opposed to messages regarding the language | ||
* server, which appear in a separate output channel. | ||
**/ | ||
export class Logger { | ||
private readonly output = vscode.window.createOutputChannel('Starcoin IDE Output'); | ||
|
||
/** Log an informational message (as opposed to an error or a warning). */ | ||
info(message: string): void { | ||
this.write('INFO', message); | ||
} | ||
|
||
private write(label: string, message: string): void { | ||
this.output.appendLine(`${label} [${new Date().toLocaleString()}]: ${message}`); | ||
} | ||
}; | ||
// Copyright (c) The Diem Core Contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import * as vscode from 'vscode'; | ||
|
||
/** | ||
* A logger for the VS Code extension. | ||
* | ||
* Messages that are logged appear in an output channel created below that is dedicated to the | ||
* extension (or "client"), in the extension user's "Output View." This logger should be used for | ||
* messages related to VS Code and this extension, as opposed to messages regarding the language | ||
* server, which appear in a separate output channel. | ||
**/ | ||
export class Logger { | ||
private readonly output = vscode.window.createOutputChannel('Starcoin IDE Output'); | ||
|
||
/** Log an informational message (as opposed to an error or a warning). */ | ||
info(message: string): void { | ||
this.write('INFO', message); | ||
} | ||
|
||
private write(label: string, message: string): void { | ||
this.output.appendLine(`${label} [${new Date().toLocaleString()}]: ${message}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.