Skip to content

Commit

Permalink
Sort imports
Browse files Browse the repository at this point in the history
Signed-off-by: Nok Lam Chan <[email protected]>
  • Loading branch information
noklam committed Aug 8, 2024
1 parent 076cac0 commit 21332aa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/common/commands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { QuickPickItem, window } from 'vscode';
import * as fs from 'fs';
import { QuickPickItem, window } from 'vscode';
import { getWorkspaceFolders } from './vscodeapi';

export async function selectEnvironment() {
Expand Down
3 changes: 1 addition & 2 deletions src/common/status_bar.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as vscode from 'vscode';
import {getProjectRoot } from './utilities';
import {

getWorkspaceSettings,
} from './settings';
import { getProjectRoot } from './utilities';

export async function createStatusBar(commandName: string, serverId:string): Promise<vscode.StatusBarItem>{
// Create a status bar item
Expand Down
28 changes: 10 additions & 18 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { selectEnvironment } from './common/commands';
import * as vscode from 'vscode';
import { LanguageClient } from 'vscode-languageclient/node';
import { selectEnvironment } from './common/commands';
import { registerLogger, traceError, traceLog, traceVerbose } from './common/log/logging';
import {
checkVersion,
Expand All @@ -12,17 +12,11 @@ import {
resolveInterpreter,
} from './common/python';
import { restartServer } from './common/server';
import {
checkIfConfigurationChanged,
getExtensionSettings,
getGlobalSettings,
getInterpreterFromSetting,
getWorkspaceSettings,
} from './common/settings';
import { checkIfConfigurationChanged, getInterpreterFromSetting } from './common/settings';
import { loadServerDefaults } from './common/setup';
import { getLSClientTraceLevel, getProjectRoot } from './common/utilities';
import { createOutputChannel, onDidChangeConfiguration, registerCommand } from './common/vscodeapi';
import { createStatusBar } from './common/status_bar';
import { getLSClientTraceLevel } from './common/utilities';
import { createOutputChannel, onDidChangeConfiguration, registerCommand } from './common/vscodeapi';

let lsClient: LanguageClient | undefined;
export async function activate(context: vscode.ExtensionContext): Promise<void> {
Expand All @@ -32,12 +26,18 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
const serverName = serverInfo.name;
const serverId = serverInfo.module;

// Log Server information
traceLog(`Name: ${serverInfo.name}`);
traceLog(`Module: ${serverInfo.module}`);
traceVerbose(`Full Server Info: ${JSON.stringify(serverInfo)}`);

// List of commands
const CMD_RESTART_SERVER = `${serverId}.restart`;
const CMD_SELECT_ENV = `${serverId}.selectEnvironment`;

// Status Bar
const statusBarItem = await createStatusBar(CMD_SELECT_ENV, serverId);
context.subscriptions.push(statusBarItem);

// Setup logging
const outputChannel = createOutputChannel(serverName);
Expand All @@ -57,11 +57,6 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
}),
);

// Log Server information
traceLog(`Name: ${serverInfo.name}`);
traceLog(`Module: ${serverInfo.module}`);
traceVerbose(`Full Server Info: ${JSON.stringify(serverInfo)}`);

const runServer = async (selectedEnvironment?: vscode.QuickPickItem) => {
const interpreter = getInterpreterFromSetting(serverId);
let env = undefined;
Expand Down Expand Up @@ -95,9 +90,6 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
);
};


context.subscriptions.push(statusBarItem);

context.subscriptions.push(
onDidChangePythonInterpreter(async () => {
await runServer();
Expand Down

0 comments on commit 21332aa

Please sign in to comment.