mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
Use toFileLocationRequestArgs
This commit is contained in:
@@ -10,7 +10,6 @@ import { ConfigurationDependentRegistration } from '../utils/dependentRegistrati
|
|||||||
import * as typeConverters from '../utils/typeConverters';
|
import * as typeConverters from '../utils/typeConverters';
|
||||||
import FileConfigurationManager from './fileConfigurationManager';
|
import FileConfigurationManager from './fileConfigurationManager';
|
||||||
|
|
||||||
|
|
||||||
class TypeScriptFormattingProvider implements vscode.DocumentRangeFormattingEditProvider, vscode.OnTypeFormattingEditProvider {
|
class TypeScriptFormattingProvider implements vscode.DocumentRangeFormattingEditProvider, vscode.OnTypeFormattingEditProvider {
|
||||||
public constructor(
|
public constructor(
|
||||||
private readonly client: ITypeScriptServiceClient,
|
private readonly client: ITypeScriptServiceClient,
|
||||||
@@ -56,17 +55,15 @@ class TypeScriptFormattingProvider implements vscode.DocumentRangeFormattingEdit
|
|||||||
options: vscode.FormattingOptions,
|
options: vscode.FormattingOptions,
|
||||||
token: vscode.CancellationToken
|
token: vscode.CancellationToken
|
||||||
): Promise<vscode.TextEdit[]> {
|
): Promise<vscode.TextEdit[]> {
|
||||||
const filepath = this.client.toPath(document.uri);
|
const file = this.client.toPath(document.uri);
|
||||||
if (!filepath) {
|
if (!file) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.formattingOptionsManager.ensureConfigurationOptions(document, options, token);
|
await this.formattingOptionsManager.ensureConfigurationOptions(document, options, token);
|
||||||
|
|
||||||
const args: Proto.FormatOnKeyRequestArgs = {
|
const args: Proto.FormatOnKeyRequestArgs = {
|
||||||
file: filepath,
|
...typeConverters.Position.toFileLocationRequestArgs(file, position),
|
||||||
line: position.line + 1,
|
|
||||||
offset: position.character + 1,
|
|
||||||
key: ch
|
key: ch
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user