Skip to content

Commit

Permalink
add slight protections
Browse files Browse the repository at this point in the history
  • Loading branch information
gcampbell-msft committed Dec 6, 2024
1 parent 1636f95 commit 1d5d08e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import { DebuggerInformation, getDebuggerPipeName } from '@cmt/debug/cmakeDebugg
import { DebugConfigurationProvider, DynamicDebugConfigurationProvider } from '@cmt/debug/cmakeDebugger/debugConfigurationProvider';
import { deIntegrateTestExplorer } from "@cmt/ctest";
import { LanguageServiceData } from './languageServices/languageServiceData';
import { file } from 'tmp';

nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
Expand Down Expand Up @@ -2365,9 +2364,13 @@ export async function activate(context: vscode.ExtensionContext): Promise<api.CM
{ language: CMAKE_LANGUAGE, scheme: 'untitled'}
];

const languageServices = await LanguageServiceData.create();
vscode.languages.registerHoverProvider(CMAKE_SELECTOR, languageServices);
vscode.languages.registerCompletionItemProvider(CMAKE_SELECTOR, languageServices);
try {
const languageServices = await LanguageServiceData.create();
vscode.languages.registerHoverProvider(CMAKE_SELECTOR, languageServices);
vscode.languages.registerCompletionItemProvider(CMAKE_SELECTOR, languageServices);
} catch {
log.error(localize('language.service.failed', 'Failed to initialize language services'));
}

vscode.languages.setLanguageConfiguration(CMAKE_LANGUAGE, {
indentationRules: {
Expand Down
2 changes: 0 additions & 2 deletions src/languageServices/languageServiceData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ export class LanguageServiceData implements vscode.HoverProvider, vscode.Complet
}

private async load(): Promise<void> {
const test = thisExtensionPath();
console.log(test);
const locale: string = util.getLocaleId();
this.commands = JSON.parse(await this.getFile("commands.json", locale));
this.variables = JSON.parse(await this.getFile("variables.json", locale));
Expand Down

0 comments on commit 1d5d08e

Please sign in to comment.