提交 2d9d8dc1 编写于 作者: S Sandeep Somavarapu

apiExample

上级 77c83114
......@@ -284,6 +284,42 @@ export class ExtHostConfigProvider {
return scopes.reduce((result, scope) => { result.set(scope[0], scope[1]); return result; }, new Map<string, ConfigurationScope | undefined>());
}
apiExample() {
/**
* Most often scenario: Read window configuration effectively
*/
const windowConfiguration = vscode.workspace.getConfiguration('window');
windowConfiguration.get('size');
windowConfiguration.update('size', 2); // Updates in workspace
/**
* Most often scenario: Read and Write workspace folder configuration effectively
*/
const workspaceFolderConfiguration = vscode.workspace.getConfiguration('git', vscode.workspace.workspaceFolders![0]);
workspaceFolderConfiguration.get('enabled');
workspaceFolderConfiguration.update('enabled', false); // Effective update
/**
* Most often scenario: Read and Write language configuration effectively
*/
const textDocumentConfiguration = vscode.workspace.getConfiguration('editor', vscode.window.activeTextEditor?.document!);
textDocumentConfiguration.get('formatOnSave');
textDocumentConfiguration.update('formatOnSave', false); //Effective update.
/**
* Special scenario: Write a configuration under a specific language
*/
const configuration = vscode.workspace.getConfiguration('editor', { resource: vscode.Uri.file('abc'), language: 'javascript' });
configuration.update('formatOnSave', false); // Writes under languge overrides
/**
* deprecated
*/
vscode.workspace.getConfiguration('editor', vscode.Uri.file('abc'));
vscode.workspace.getConfiguration('editor', null);
}
}
export const IExtHostConfiguration = createDecorator<IExtHostConfiguration>('IExtHostConfiguration');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册