How to use the vscode-languageclient.SettingMonitor function in vscode-languageclient

To help you get started, we’ve selected a few vscode-languageclient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / vscode-jscs / jscs / extension.ts View on Github external
let serverOptions = {
		run: { module: serverModule },
		debug: { module: serverModule, options: debugOptions}
	};

	let clientOptions: LanguageClientOptions = {
		documentSelector: ['javascript', 'javascriptreact'],
		synchronize: {
			configurationSection: 'jscs',
			fileEvents: workspace.createFileSystemWatcher('**/.jscsrc')
		}
	}

	let client = new LanguageClient('JSCS', serverOptions, clientOptions);
	
	context.subscriptions.push(new SettingMonitor(client, 'jscs.enable').start());

	// commands.registerCommand('jscs.fixFile', () => {
	// 	client.sendRequest(MyCommandRequest.type, { command: "jscs-quickfix"}).then((result) => {
	// 		window.showInformationMessage(result.message);
	// 	});
	// });
}
github mrmlnc / vscode-doiuse / src / client.ts View on Github external
options: {
				execArgv: ['--nolazy', '--debug=6004']
			}
		}
	};

	const client = new LanguageClient(
		'doiuse',
		'doiuse language server',
		serverOptions,
		clientOptions
	);

	// Go to the world
	context.subscriptions.push(
		new SettingMonitor(client, 'doiuse.enable').start()
	);
}
github jbenden / vscode-c-cpp-flylint / client / src / extension.ts View on Github external
// Synchronize the setting section "c-cpp-flylint" to the server.
            configurationSection: "c-cpp-flylint",
            fileEvents: workspace.createFileSystemWatcher("**/{c_cpp_properties.json,.clang_complete,.flexelint.lnt}")
        }
    };

    const client = new LanguageClient("c-cpp-flylint", "C/C++ Flylint", serverOptions, clientOptions);

    client.onReady()
        .then(() => {
            client.onRequest('activeTextDocument', () => {
                return window.activeTextEditor!.document;
            });
        });

    context.subscriptions.push(new SettingMonitor(client, "c-cpp-flylint.enable").start());
}
github microsoft / vscode-htmlhint / htmlhint / extension.ts View on Github external
let languages: string[] = config.get('documentSelector');
    let documentSelector = languages.map(language => ({ language, scheme: 'file' }));

    // Set options
    let clientOptions: LanguageClientOptions = {
        documentSelector,
        diagnosticCollectionName: 'htmlhint',
        synchronize: {
            configurationSection: 'htmlhint',
            fileEvents: workspace.createFileSystemWatcher('**/.htmlhintrc')
        }
    }

    let forceDebug = false;
    let client = new LanguageClient('HTML-hint', serverOptions, clientOptions, forceDebug);
    context.subscriptions.push(new SettingMonitor(client, 'htmlhint.enable').start());
}
github microsoft / vscode-jshint / jshint / extension.ts View on Github external
synchronize: {
			configurationSection: 'jshint',
			fileEvents: [workspace.createFileSystemWatcher('**/.jshint{rc,ignore}'), workspace.createFileSystemWatcher('**/package.json')]
		},
		initializationOptions: () => {
			const configuration = workspace.getConfiguration('jshint');
			return {
				nodePath: configuration && configuration.nodePath,
				packageManager: configuration && configuration.packageManager
			};
		}
	};

	let client = new LanguageClient('jshint', serverOptions, clientOptions);
	context.subscriptions.push(
		new SettingMonitor(client, 'jshint.enable').start(),
		commands.registerCommand('jshint.showOutputChannel', () => client.outputChannel.show())
	);
}
github stylelint / vscode-stylelint / index.js View on Github external
uri: textEditor.document.uri.toString(),
				version: textEditor.document.version,
			};
			const params = {
				command: 'stylelint.applyAutoFix',
				arguments: [textDocument],
			};

			client.sendRequest(ExecuteCommandRequest.type, params).then(undefined, () => {
				Window.showErrorMessage(
					'Failed to apply styleint fixes to the document. Please consider opening an issue with steps to reproduce.',
				);
			});
		}),
	);
	subscriptions.push(new SettingMonitor(client, 'stylelint.enable').start());
};
github deepscan / vscode-deepscan / client / src / extension.ts View on Github external
context.subscriptions.push(activeDecorations.disposables);

        client.onNotification(StatusNotification.type, (params) => {
            const { state, uri } = params;
            updateStatus(state);
            showNotificationIfNeeded(params);
            activeDecorations.updateDecorations(uri);
        });

        client.onNotification(exitCalled, (params) => {
            serverCalledProcessExit = true;
            client.error(`Server process exited with code ${params[0]}. This usually indicates a misconfigured setup.`, params[1]);
            vscode.window.showErrorMessage(`DeepScan server shut down. See 'DeepScan' output channel for details.`);
        });
    });
    const disposable = new SettingMonitor(client, 'deepscan.enable').start();
    context.subscriptions.push(disposable);

    let rules = [];
    try {
        const rulesObj = JSON.parse(fs.readFileSync(context.asAbsolutePath(path.join('client', 'resources', 'deepscan-rules.json'))).toString());
        rules = rulesObj.rules;
    } catch (e) {
        vscode.window.showWarningMessage(`Can't read or parse rule definitions: ${e.message}`);
    }

    let style: string = '';
    try {
        style = fs.readFileSync(context.asAbsolutePath(path.join('client', 'resources', 'style.css'))).toString();
    } catch (e) {
        vscode.window.showWarningMessage(`Can't read a style: ${e.message}`);
    }
github mrmlnc / vscode-doiuse / extension.js View on Github external
execArgv: ['--nolazy', '--debug=6004']
			}
		}
	};

	const serverOptions = {
		documentSelector: ['css', 'less', 'stylus', 'scss', 'sass', 'sass-indented'],
		synchronize: {
			configurationSection: 'doiuse'
		},
		diagnosticCollectionName: 'doiuse'
	};

	const client = new LanguageClient('doiuse', clientOptions, serverOptions);

	context.subscriptions.push(new SettingMonitor(client, 'doiuse.enable').start());
}
github csstree / vscode-plugin / src / extension.ts View on Github external
module: serverModule,
        transport: TransportKind.ipc,
        options: {
          execArgv: ['--nolazy', '--debug=6004']
        }
      }
    },
    {
      documentSelector: ['css'],
      synchronize: {
        configurationSection: 'csstree'
      }
    }
  );

  context.subscriptions.push(new SettingMonitor(client, 'csstree.enable').start());
};