Skip to content

Commit

Permalink
Add back logging to open service.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackson Kearl committed Feb 5, 2021
1 parent dae51e3 commit 52838cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/vs/editor/standalone/browser/standaloneEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
import { StandaloneThemeServiceImpl } from 'vs/editor/standalone/browser/standaloneThemeServiceImpl';
import { splitLines } from 'vs/base/common/strings';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ILogService } from 'vs/platform/log/common/log';

type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;

Expand All @@ -56,7 +57,7 @@ function withAllStandaloneServices<T extends IEditor>(domElement: HTMLElement, o
}

if (!services.has(IOpenerService)) {
services.set(IOpenerService, new OpenerService(services.get(ICodeEditorService), services.get(ICommandService)));
services.set(IOpenerService, new OpenerService(services.get(ICodeEditorService), services.get(ICommandService), services.get(ILogService)));
}

let result = callback(services);
Expand Down
17 changes: 9 additions & 8 deletions src/vs/editor/test/browser/services/openerService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { URI } from 'vs/base/common/uri';
import { OpenerService } from 'vs/editor/browser/services/openerService';
import { TestCodeEditorService } from 'vs/editor/test/browser/editorTestServices';
import { CommandsRegistry, ICommandService, NullCommandService } from 'vs/platform/commands/common/commands';
import { NullLogService } from 'vs/platform/log/common/log';
import { matchesScheme } from 'vs/platform/opener/common/opener';

suite('OpenerService', function () {
Expand All @@ -30,13 +31,13 @@ suite('OpenerService', function () {
});

test('delegate to editorService, scheme:///fff', async function () {
const openerService = new OpenerService(editorService, NullCommandService);
const openerService = new OpenerService(editorService, NullCommandService, new NullLogService());
await openerService.open(URI.parse('another:///somepath'));
assert.equal(editorService.lastInput!.options!.selection, undefined);
});

test('delegate to editorService, scheme:///fff#L123', async function () {
const openerService = new OpenerService(editorService, NullCommandService);
const openerService = new OpenerService(editorService, NullCommandService, new NullLogService());

await openerService.open(URI.parse('file:///somepath#L23'));
assert.equal(editorService.lastInput!.options!.selection!.startLineNumber, 23);
Expand All @@ -58,7 +59,7 @@ suite('OpenerService', function () {
});

test('delegate to editorService, scheme:///fff#123,123', async function () {
const openerService = new OpenerService(editorService, NullCommandService);
const openerService = new OpenerService(editorService, NullCommandService, new NullLogService());

await openerService.open(URI.parse('file:///somepath#23'));
assert.equal(editorService.lastInput!.options!.selection!.startLineNumber, 23);
Expand All @@ -76,7 +77,7 @@ suite('OpenerService', function () {
});

test('delegate to commandsService, command:someid', async function () {
const openerService = new OpenerService(editorService, commandService);
const openerService = new OpenerService(editorService, commandService, new NullLogService());

const id = `aCommand${Math.random()}`;
CommandsRegistry.registerCommand(id, function () { });
Expand All @@ -98,7 +99,7 @@ suite('OpenerService', function () {
});

test('links are protected by validators', async function () {
const openerService = new OpenerService(editorService, commandService);
const openerService = new OpenerService(editorService, commandService, new NullLogService());

openerService.registerValidator({ shouldOpen: () => Promise.resolve(false) });

Expand All @@ -109,7 +110,7 @@ suite('OpenerService', function () {
});

test('links validated by validators go to openers', async function () {
const openerService = new OpenerService(editorService, commandService);
const openerService = new OpenerService(editorService, commandService, new NullLogService());

openerService.registerValidator({ shouldOpen: () => Promise.resolve(true) });

Expand All @@ -128,7 +129,7 @@ suite('OpenerService', function () {
});

test('links validated by multiple validators', async function () {
const openerService = new OpenerService(editorService, commandService);
const openerService = new OpenerService(editorService, commandService, new NullLogService());

let v1 = 0;
openerService.registerValidator({
Expand Down Expand Up @@ -165,7 +166,7 @@ suite('OpenerService', function () {
});

test('links invalidated by first validator do not continue validating', async function () {
const openerService = new OpenerService(editorService, commandService);
const openerService = new OpenerService(editorService, commandService, new NullLogService());

let v1 = 0;
openerService.registerValidator({
Expand Down

0 comments on commit 52838cf

Please sign in to comment.