Skip to content

Commit

Permalink
Switch ResolverService to ContributorData in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zm-cttae committed Nov 13, 2024
1 parent 640675c commit afa5eb3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions test/context/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import { MockGlobalMemento, MockMemento } from './memento';
import { StubSecretStorage } from './secret';
import { MockEnvironmentVariableCollection } from './variables';

import { default as TextmateLanguageService } from '../../src/main';
import { ContributorData } from '../util/common';

const resolver = new TextmateLanguageService.utils.ResolverService(
TextmateLanguageService.utils.getOniguruma()
);
const contributorData = new ContributorData();

export class MockExtensionContext implements vscode.ExtensionContext {
public readonly subscriptions: vscode.Disposable[];
Expand Down Expand Up @@ -56,7 +54,7 @@ export class MockExtensionContext implements vscode.ExtensionContext {
this.logPath = `${codeRoot}/user-data/User/logs`;
this.logUri = vscode.Uri.file(this.logPath);

const extension = resolver.getExtensionFromLanguageId(id);
const extension = contributorData.getExtensionFromLanguageId(id);
if (typeof extension === 'undefined') {
if (globalThis.languageId === id) {
throw new Error('Could not find extension for language ID "' + id +'"');
Expand Down
4 changes: 2 additions & 2 deletions test/util/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export async function writeJsonFile(uri: vscode.Uri, json: PartialJsonValue): Pr
/** `loadJsonFile` utility. */
export const loadJsonFile = TextmateLanguageService.utils.loadJsonFile;

/** `TextmateScopeSelectorMap` utility. */
export const ResolverService = TextmateLanguageService.utils.ResolverService;
/** `ContributorData` utility. */
export const ContributorData = TextmateLanguageService.utils.ContributorData;

/** `TextmateScopeSelector` utility. */
export const TextmateScopeSelector = TextmateLanguageService.utils.TextmateScopeSelector;
Expand Down

0 comments on commit afa5eb3

Please sign in to comment.