diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e10df1043deb..5b677c92cf925 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Breaking changes: - [task] `TaskService.getConfiguredTasks()` returns `Promise` instead of `TaskConfiguration[]` [#5777](https://github.com/theia-ide/theia/pull/5777) +- [plugin] files from 'plugin-ext/src/api' moved to 'plugin-ext/src/common', renamed 'model.ts' to 'plugin-api-rpc-model.ts', 'plugin-api.ts' to 'plugin-api-rpc.ts' Breaking changes: - [shell][plugin] integrated view containers and views [#5665](https://github.com/theia-ide/theia/pull/5665) diff --git a/configs/errors.tslint.json b/configs/errors.tslint.json index f70b4aee7a3d4..d0d242cab873b 100644 --- a/configs/errors.tslint.json +++ b/configs/errors.tslint.json @@ -131,6 +131,11 @@ true, "allow-null-check" ], + "typedef": [ + true, + "call-signature", + "property-declaration" + ], "typedef-whitespace": [ true, { diff --git a/configs/warnings.tslint.json b/configs/warnings.tslint.json index 89b4a5b29b0e5..7bed2ac0a6457 100644 --- a/configs/warnings.tslint.json +++ b/configs/warnings.tslint.json @@ -10,11 +10,6 @@ "deprecation": true, "no-return-await": { "severity": "warning" - }, - "typedef": [ - true, - "call-signature", - "property-declaration" - ] + } } } diff --git a/dev-packages/application-manager/src/generator/abstract-generator.ts b/dev-packages/application-manager/src/generator/abstract-generator.ts index 3ad0036bf94c2..93fe8dccfa287 100644 --- a/dev-packages/application-manager/src/generator/abstract-generator.ts +++ b/dev-packages/application-manager/src/generator/abstract-generator.ts @@ -62,11 +62,11 @@ export abstract class AbstractGenerator { return os.EOL + lines.join(os.EOL); } - protected ifBrowser(value: string, defaultValue: string = '') { + protected ifBrowser(value: string, defaultValue: string = ''): string { return this.pck.ifBrowser(value, defaultValue); } - protected ifElectron(value: string, defaultValue: string = '') { + protected ifElectron(value: string, defaultValue: string = ''): string { return this.pck.ifElectron(value, defaultValue); } @@ -75,7 +75,7 @@ export abstract class AbstractGenerator { await fs.writeFile(path, content); } - protected ifMonaco(value: () => string, defaultValue: () => string = () => '') { + protected ifMonaco(value: () => string, defaultValue: () => string = () => ''): string { return (this.pck.extensionPackages.some(e => e.name === '@theia/monaco') ? value : defaultValue)(); } diff --git a/dev-packages/application-manager/src/rebuild.ts b/dev-packages/application-manager/src/rebuild.ts index f983fbf0bf6f9..9e6c36550025e 100644 --- a/dev-packages/application-manager/src/rebuild.ts +++ b/dev-packages/application-manager/src/rebuild.ts @@ -18,7 +18,7 @@ import fs = require('fs-extra'); import path = require('path'); import cp = require('child_process'); -export function rebuild(target: 'electron' | 'browser', modules: string[]) { +export function rebuild(target: 'electron' | 'browser', modules: string[]): void { const nodeModulesPath = path.join(process.cwd(), 'node_modules'); const browserModulesPath = path.join(process.cwd(), '.browser_modules'); const modulesToProcess = modules || ['@theia/node-pty', 'nsfw', 'native-keymap', 'find-git-repositories']; diff --git a/dev-packages/application-package/src/extension-package.spec.ts b/dev-packages/application-package/src/extension-package.spec.ts index 9c5d90b378d42..a9e94700777ec 100644 --- a/dev-packages/application-package/src/extension-package.spec.ts +++ b/dev-packages/application-package/src/extension-package.spec.ts @@ -30,7 +30,7 @@ const testOutdated = (expectation: (extensionPackage: ExtensionPackage) => boole assert.equal(await expectation(extensionPackage), outdated); }); -describe('extension-package', function () { +describe('extension-package', function (): void { this.timeout(10000); describe('isOutdated', () => { diff --git a/dev-packages/application-package/src/npm-registry.ts b/dev-packages/application-package/src/npm-registry.ts index 0b52da3fc1875..7816805004ba1 100644 --- a/dev-packages/application-package/src/npm-registry.ts +++ b/dev-packages/application-package/src/npm-registry.ts @@ -71,7 +71,9 @@ export interface ViewResult { [key: string]: any } -export function sortByKey(object: { [key: string]: any }) { +export function sortByKey(object: { [key: string]: any }): { + [key: string]: any; +} { return Object.keys(object).sort().reduce((sorted, key) => { sorted[key] = object[key]; return sorted; @@ -101,7 +103,7 @@ export class NpmRegistry { this.resetIndex(); } - updateProps(props?: Partial) { + updateProps(props?: Partial): void { const oldRegistry = this.props.registry; Object.assign(this.props, props); const newRegistry = this.props.registry; diff --git a/dev-packages/cli/src/theia.ts b/dev-packages/cli/src/theia.ts index 9e44b0a3ea7fe..0c026d334ed82 100644 --- a/dev-packages/cli/src/theia.ts +++ b/dev-packages/cli/src/theia.ts @@ -52,7 +52,7 @@ function rebuildCommand(command: string, target: ApplicationProps.Target): yargs }; } -(function () { +(function (): void { const projectPath = process.cwd(); const appTarget: ApplicationProps.Target = yargs.argv['app-target']; const manager = new ApplicationPackageManager({ projectPath, appTarget }); diff --git a/examples/browser/test/bottom-panel/bottom-panel.ts b/examples/browser/test/bottom-panel/bottom-panel.ts index a1039e1d75b9a..f4e0e790460a8 100644 --- a/examples/browser/test/bottom-panel/bottom-panel.ts +++ b/examples/browser/test/bottom-panel/bottom-panel.ts @@ -30,7 +30,7 @@ export class BottomPanel { return (tab.$('..').getAttribute('class').split(' ').indexOf('p-mod-current') > -1); } - openTab(tabName: string) { + openTab(tabName: string): void { this.driver.element('#theia-bottom-content-panel .p-TabBar .p-TabBar-content').click(`div=${tabName}`); } @@ -38,7 +38,7 @@ export class BottomPanel { return this.driver.isExisting('.p-Widget div.terminal.xterm'); } - waitForTerminal() { + waitForTerminal(): void { this.driver.waitForExist('.p-Widget div.terminal.xterm'); // Wait for animations to finish this.driver.pause(300); @@ -48,7 +48,7 @@ export class BottomPanel { return this.driver.isExisting('.p-Widget div.theia-marker-container'); } - waitForProblemsView() { + waitForProblemsView(): void { this.driver.waitForExist('.p-Widget div.theia-marker-container'); // Wait for animations to finish this.driver.pause(300); @@ -58,7 +58,7 @@ export class BottomPanel { return this.driver.isExisting('#callhierarchy'); } - waitForCallHierarchyView() { + waitForCallHierarchyView(): void { this.driver.waitForExist('#callhierarchy'); // Wait for animations to finish this.driver.pause(300); @@ -68,13 +68,13 @@ export class BottomPanel { return this.driver.isExisting('.p-Widget div.theia-output'); } - waitForOutputView() { + waitForOutputView(): void { this.driver.waitForExist('.p-Widget div.theia-output'); // Wait for animations to finish this.driver.pause(300); } - closeCurrentView() { + closeCurrentView(): void { this.driver.click('#theia-bottom-content-panel .p-TabBar-tab.p-mod-current .p-TabBar-tabCloseIcon'); } diff --git a/examples/browser/test/cpp/cpp-change-build-config.ui-spec.ts b/examples/browser/test/cpp/cpp-change-build-config.ui-spec.ts index a6caa984f2894..53540b07966ff 100644 --- a/examples/browser/test/cpp/cpp-change-build-config.ui-spec.ts +++ b/examples/browser/test/cpp/cpp-change-build-config.ui-spec.ts @@ -83,7 +83,7 @@ int main() {} /** * Return whether clangd is available. */ -function hasClangd() { +function hasClangd(): boolean { try { const out = cp.execSync('clangd -version', { encoding: 'utf8' }); // Match 'clangd version' at the start of @@ -98,7 +98,7 @@ function hasClangd() { * Open the build config quick open menu, click on the first config that * matches `name`. */ -function changeBuildConfig(name: string, driver: WebdriverIO.Client) { +function changeBuildConfig(name: string, driver: WebdriverIO.Client): void { const statusBar = driver.element('#theia-statusBar'); const statusBarButton = statusBar.element('div.element*=Build Config'); statusBarButton.click(); @@ -110,7 +110,7 @@ function changeBuildConfig(name: string, driver: WebdriverIO.Client) { } // skip the cpp tests for the moment since they are broken. -describe.skip('cpp extension', function () { +describe.skip('cpp extension', function (): void { before(() => { const driver = browser; @@ -127,7 +127,7 @@ describe.skip('cpp extension', function () { mainPage.waitForStartup(); }); - it.skip('should be able to change build config', function () { + it.skip('should be able to change build config', function (): void { if (!hasClangd()) { this.skip(); return; diff --git a/examples/browser/test/left-panel/left-panel.ts b/examples/browser/test/left-panel/left-panel.ts index 8d6b92e823621..ae444495f5c0f 100644 --- a/examples/browser/test/left-panel/left-panel.ts +++ b/examples/browser/test/left-panel/left-panel.ts @@ -30,13 +30,13 @@ export class LeftPanel { return (tab.$('..').getAttribute('class').split(' ').indexOf('p-mod-current') !== -1); } - openCloseTab(tabName: string) { + openCloseTab(tabName: string): void { this.driver.element('.p-TabBar.theia-app-left .p-TabBar-content').element(`div*=${tabName}`).click('..'); // Wait for animations to finish this.driver.pause(300); } - collapseTab(tabName: string) { + collapseTab(tabName: string): void { this.driver.element('.p-TabBar.theia-app-left .p-TabBar-content').rightClick(`div*=${tabName}`); this.driver.element('.p-Widget.p-Menu .p-Menu-content').click('div=Collapse'); } @@ -57,7 +57,7 @@ export class LeftPanel { * collapse it. No check is done to make sure this node actually exists or * represents a directory. */ - toggleDirectoryInFilesView(name: string) { + toggleDirectoryInFilesView(name: string): void { this.waitForFilesViewVisible(); const files = this.driver.element('#files'); const element = files.element('div=' + name); @@ -70,7 +70,7 @@ export class LeftPanel { * it. Not check is done to make sure this node actually exists or * represents a file. */ - openFileInFilesView(name: string) { + openFileInFilesView(name: string): void { this.waitForFilesViewVisible(); const files = this.driver.element('#files'); const element = files.element('div=' + name); diff --git a/examples/browser/test/main-page/main-page.ts b/examples/browser/test/main-page/main-page.ts index 3ce19aaa6796e..c573c5d4fb95d 100644 --- a/examples/browser/test/main-page/main-page.ts +++ b/examples/browser/test/main-page/main-page.ts @@ -56,7 +56,7 @@ export class MainPage { return this.driver.waitForExist('div#theia-statusBar'); } - closeAll() { + closeAll(): void { /* Make sure that all the "docked" layouts are closed */ while (this.driver.isExisting('.p-Widget.p-TabBar .p-TabBar-tab.p-mod-closable')) { this.driver.rightClick('.p-Widget.p-TabBar .p-TabBar-tab.p-mod-closable'); diff --git a/examples/browser/test/right-panel/right-panel.ts b/examples/browser/test/right-panel/right-panel.ts index 7a8b2ed96b118..9e1852650e285 100644 --- a/examples/browser/test/right-panel/right-panel.ts +++ b/examples/browser/test/right-panel/right-panel.ts @@ -30,13 +30,13 @@ export class RightPanel { return (tab.$('..').getAttribute('class').split(' ').indexOf('p-mod-current') !== -1); } - openCloseTab(tabName: string) { + openCloseTab(tabName: string): void { this.driver.element('.p-TabBar.theia-app-right .p-TabBar-content').element(`div=${tabName}`).click('..'); // Wait for animations to finish this.driver.pause(300); } - collapseTab(tabName: string) { + collapseTab(tabName: string): void { this.driver.element('.p-TabBar.theia-app-right .p-TabBar-content').rightClick(`div=${tabName}`); this.driver.element('.p-Widget.p-Menu .p-Menu-content').click('div=Collapse'); } diff --git a/examples/browser/test/top-panel/top-panel.ts b/examples/browser/test/top-panel/top-panel.ts index 7899757a16fff..ca2c8f377127b 100644 --- a/examples/browser/test/top-panel/top-panel.ts +++ b/examples/browser/test/top-panel/top-panel.ts @@ -24,52 +24,52 @@ export class TopPanel { return this.driver.isExisting('div#theia-top-panel'); } - openNewTerminal() { + openNewTerminal(): void { this.clickMenuTab('Terminal'); this.clickSubMenu('New Terminal'); } - toggleCallHierarchyView() { + toggleCallHierarchyView(): void { this.clickMenuTab('View'); this.clickSubMenu('Call Hierarchy'); } - toggleFilesView() { + toggleFilesView(): void { this.clickMenuTab('View'); this.clickSubMenu('Explorer'); } - toggleScmView() { + toggleScmView(): void { this.clickMenuTab('View'); this.clickSubMenu('SCM'); } - toggleGitHistoryView() { + toggleGitHistoryView(): void { this.clickMenuTab('View'); this.clickSubMenu('Git History'); } - toggleOutlineView() { + toggleOutlineView(): void { this.clickMenuTab('View'); this.clickSubMenu('Outline'); } - toggleOutputView() { + toggleOutputView(): void { this.clickMenuTab('View'); this.clickSubMenu('Output'); } - openPluginsView() { + openPluginsView(): void { this.clickMenuTab('View'); this.clickSubMenu('Plugins'); } - openProblemsView() { + openProblemsView(): void { this.clickMenuTab('View'); this.clickSubMenu('Problems'); } - toggleSearchView() { + toggleSearchView(): void { this.clickMenuTab('View'); this.clickSubMenu('Search'); } @@ -82,7 +82,7 @@ export class TopPanel { return this.driver.isExisting('div.p-Widget.p-Menu.p-MenuBar-menu'); } - clickMenuTab(tab: number | string) { + clickMenuTab(tab: number | string): void { if (typeof tab === 'string') { this.driver.element('ul.p-MenuBar-content').click(`div=${tab}`); } else { @@ -90,11 +90,11 @@ export class TopPanel { } } - clickSubMenu(subMenuItem: string) { + clickSubMenu(subMenuItem: string): void { this.driver.element('div.p-Widget.p-Menu.p-MenuBar-menu .p-Menu-content').click(`div=${subMenuItem}`); } - hoverMenuTab(tabNumber: number) { + hoverMenuTab(tabNumber: number): void { this.driver.moveToObject(`ul.p-MenuBar-content > .p-MenuBar-item:nth-child(${tabNumber})`); } @@ -106,7 +106,7 @@ export class TopPanel { return this.driver.isExisting('#theia\\:menubar.p-mod-active'); } - getxBarTabPosition(tabNumber: number) { + getxBarTabPosition(tabNumber: number): WebdriverIO.Client & number { return this.driver.getLocation(`ul.p-MenuBar-content > .p-MenuBar-item:nth-child(${tabNumber}`, 'x'); } diff --git a/packages/bunyan/src/node/bunyan-logger-server.ts b/packages/bunyan/src/node/bunyan-logger-server.ts index c0eee1a1d2782..ead92aea2fc22 100644 --- a/packages/bunyan/src/node/bunyan-logger-server.ts +++ b/packages/bunyan/src/node/bunyan-logger-server.ts @@ -36,7 +36,7 @@ export class BunyanLoggerServer implements ILoggerServer { protected cli: LogLevelCliContribution; @postConstruct() - protected init() { + protected init(): void { /* Create the root logger by default. */ const opts = this.makeLoggerOptions(rootLoggerName); const rootOpts = Object.assign(opts, { name: 'Theia' }); @@ -46,14 +46,17 @@ export class BunyanLoggerServer implements ILoggerServer { this.cli.onLogConfigChanged(() => this.updateLogLevels()); } - protected updateLogLevels() { + protected updateLogLevels(): void { for (const loggerName of this.loggers.keys()) { const newLevel = this.cli.logLevelFor(loggerName); this.setLogLevel(loggerName, newLevel); } } - protected makeLoggerOptions(name: string) { + protected makeLoggerOptions(name: string): { + logger: string; + level: number; + } { return { logger: name, level: this.toBunyanLevel(this.cli.logLevelFor(name)), @@ -89,7 +92,7 @@ export class BunyanLoggerServer implements ILoggerServer { } /* Set the client to receive notifications on. */ - setClient(client: ILoggerClient | undefined) { + setClient(client: ILoggerClient | undefined): void { this.client = client; } diff --git a/packages/callhierarchy/src/browser/callhierarchy-context.ts b/packages/callhierarchy/src/browser/callhierarchy-context.ts index 67b8a68797a13..f244fe2fe1390 100644 --- a/packages/callhierarchy/src/browser/callhierarchy-context.ts +++ b/packages/callhierarchy/src/browser/callhierarchy-context.ts @@ -46,6 +46,7 @@ export class CallHierarchyContext implements Disposable { return symbols; } + // tslint:disable-next-line:typedef async getEditorModelReference(uri: string) { const model = await this.textModelService.createModelReference(new URI(uri)); this.disposables.push(model); @@ -96,7 +97,7 @@ export class CallHierarchyContext implements Disposable { } } - dispose() { + dispose(): void { this.disposables.forEach(element => { element.dispose(); }); diff --git a/packages/callhierarchy/src/browser/callhierarchy-service-impl.ts b/packages/callhierarchy/src/browser/callhierarchy-service-impl.ts index 0ff576561555f..00de3a91d9445 100644 --- a/packages/callhierarchy/src/browser/callhierarchy-service-impl.ts +++ b/packages/callhierarchy/src/browser/callhierarchy-service-impl.ts @@ -79,7 +79,7 @@ export abstract class AbstractDefaultCallHierarchyService implements CallHierarc return undefined; } - protected async createContext() { + protected async createContext(): Promise { const languageClient = await this.languageClientProvider.getLanguageClient(this.languageId); if (!languageClient) { this.logger.error('No language client with ID ' + this.languageId); diff --git a/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree-widget.tsx b/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree-widget.tsx index 0bd8a540a0eb5..b369ba2d92b34 100644 --- a/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree-widget.tsx +++ b/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree-widget.tsx @@ -136,6 +136,7 @@ export class CallHierarchyTreeWidget extends TreeWidget { ; } + // tslint:disable-next-line:typedef protected toIconClass(symbolKind: number) { switch (symbolKind) { case SymbolKind.File: return 'file'; @@ -160,7 +161,7 @@ export class CallHierarchyTreeWidget extends TreeWidget { } } - private openEditor(node: TreeNode, keepFocus: boolean) { + private openEditor(node: TreeNode, keepFocus: boolean): void { let location: Location | undefined; if (DefinitionNode.is(node)) { location = node.definition.location; diff --git a/packages/callhierarchy/src/browser/utils.ts b/packages/callhierarchy/src/browser/utils.ts index d9c9bd3ee3314..109b11ba76c1c 100644 --- a/packages/callhierarchy/src/browser/utils.ts +++ b/packages/callhierarchy/src/browser/utils.ts @@ -64,7 +64,7 @@ export function filterUnique(locations: Location[] | null): Location[] { return result; } -export function startsAfter(a: Range, b: Range) { +export function startsAfter(a: Range, b: Range): boolean { if (a.start.line > b.start.line) { return true; } @@ -81,7 +81,7 @@ export function startsAfter(a: Range, b: Range) { return false; } -export function isSame(a: Location, b: Location) { +export function isSame(a: Location, b: Location): boolean { return a.uri === b.uri && a.range.start.line === b.range.start.line && a.range.end.line === b.range.end.line diff --git a/packages/console/src/browser/console-content-widget.tsx b/packages/console/src/browser/console-content-widget.tsx index 178921b104b25..32c8784d40307 100644 --- a/packages/console/src/browser/console-content-widget.tsx +++ b/packages/console/src/browser/console-content-widget.tsx @@ -34,7 +34,7 @@ export class ConsoleContentWidget extends SourceTreeWidget { this.shouldScrollToRow = this._shouldScrollToEnd; } - protected get shouldScrollToEnd() { + protected get shouldScrollToEnd(): boolean { return this._shouldScrollToEnd; } diff --git a/packages/console/src/browser/console-contribution.ts b/packages/console/src/browser/console-contribution.ts index 7941070d1c164..e57e830657bc6 100644 --- a/packages/console/src/browser/console-contribution.ts +++ b/packages/console/src/browser/console-contribution.ts @@ -124,11 +124,11 @@ export class ConsoleCommandHandler implements CommandHandler { protected readonly doExecute: ConsoleExecuteFunction ) { } - isEnabled() { + isEnabled(): boolean { return !!this.manager.currentConsole; } - isVisible() { + isVisible(): boolean { return !!this.manager.currentConsole; } diff --git a/packages/core/src/browser/common-frontend-contribution.ts b/packages/core/src/browser/common-frontend-contribution.ts index 47445679f95b8..3b492ca259e3c 100644 --- a/packages/core/src/browser/common-frontend-contribution.ts +++ b/packages/core/src/browser/common-frontend-contribution.ts @@ -247,12 +247,12 @@ export class CommonFrontendContribution implements FrontendApplicationContributi this.registerCtrlWHandling(); } - onStart() { + onStart(): void { this.storageService.getData<{ recent: Command[] }>(RECENT_COMMANDS_STORAGE_KEY, { recent: [] }) .then(tasks => this.commandRegistry.recent = tasks.recent); } - onStop() { + onStop(): void { const recent = this.commandRegistry.recent; this.storageService.setData<{ recent: Command[] }>(RECENT_COMMANDS_STORAGE_KEY, { recent }); } @@ -638,7 +638,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi ); } - protected async openAbout() { + protected async openAbout(): Promise { this.aboutDialog.open(); } @@ -651,8 +651,8 @@ export class CommonFrontendContribution implements FrontendApplicationContributi * Chrome doesn't let us rebind or prevent default the keybinding, so this * at least doesn't close the window immediately. */ - protected registerCtrlWHandling() { - function isCtrlCmd(event: KeyboardEvent) { + protected registerCtrlWHandling(): void { + function isCtrlCmd(event: KeyboardEvent): boolean { return (isOSX && event.metaKey) || (!isOSX && event.ctrlKey); } @@ -665,7 +665,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi }); } - onWillStop() { + onWillStop(): true | undefined { try { if (this.shouldPreventClose || this.shell.canSaveAll()) { return true; diff --git a/packages/core/src/browser/connection-status-service.spec.ts b/packages/core/src/browser/connection-status-service.spec.ts index cb83bb14e3292..0cc470e97fbb5 100644 --- a/packages/core/src/browser/connection-status-service.spec.ts +++ b/packages/core/src/browser/connection-status-service.spec.ts @@ -24,7 +24,7 @@ import { MockConnectionStatusService } from './test/mock-connection-status-servi disableJSDOM(); -describe('connection-status', function () { +describe('connection-status', function (): void { let connectionStatusService: MockConnectionStatusService; @@ -67,6 +67,6 @@ describe('connection-status', function () { }); -function pause(time: number = 1) { +function pause(time: number = 1): Promise { return new Promise(resolve => setTimeout(resolve, time)); } diff --git a/packages/core/src/browser/connection-status-service.ts b/packages/core/src/browser/connection-status-service.ts index 193cbeeeefd38..8e3cfc0cfc5b1 100644 --- a/packages/core/src/browser/connection-status-service.ts +++ b/packages/core/src/browser/connection-status-service.ts @@ -88,15 +88,15 @@ export abstract class AbstractConnectionStatusService implements ConnectionStatu constructor(@inject(ConnectionStatusOptions) @optional() protected readonly options: ConnectionStatusOptions = ConnectionStatusOptions.DEFAULT) { } - get onStatusChange() { + get onStatusChange(): Event { return this.statusChangeEmitter.event; } - get currentStatus() { + get currentStatus(): ConnectionStatus { return this.connectionStatus; } - dispose() { + dispose(): void { this.statusChangeEmitter.dispose(); if (this.timer) { this.clearTimeout(this.timer); @@ -121,7 +121,7 @@ export abstract class AbstractConnectionStatusService implements ConnectionStatu }, this.options.offlineTimeout); } - protected fireStatusChange(status: ConnectionStatus) { + protected fireStatusChange(status: ConnectionStatus): void { this.statusChangeEmitter.fire(status); } @@ -145,7 +145,7 @@ export class FrontendConnectionStatusService extends AbstractConnectionStatusSer @inject(PingService) protected readonly pingService: PingService; @postConstruct() - protected init() { + protected init(): void { this.schedulePing(); this.wsConnectionProvider.onIncomingMessageActivity(() => { // natural activity @@ -154,7 +154,7 @@ export class FrontendConnectionStatusService extends AbstractConnectionStatusSer }); } - protected schedulePing() { + protected schedulePing(): void { if (this.scheduledPing) { this.clearTimeout(this.scheduledPing); } @@ -197,13 +197,13 @@ export class ApplicationConnectionStatusContribution extends DefaultFrontendAppl private statusbarId = 'connection-status'; - protected handleOnline() { + protected handleOnline(): void { this.statusBar.setBackgroundColor(undefined); this.statusBar.setColor(undefined); this.statusBar.removeElement(this.statusbarId); } - protected handleOffline() { + protected handleOffline(): void { this.statusBar.setElement(this.statusbarId, { alignment: StatusBarAlignment.LEFT, text: 'Offline', diff --git a/packages/core/src/browser/endpoint.spec.ts b/packages/core/src/browser/endpoint.spec.ts index 9c11c4db2f78d..dbffef28c24b3 100644 --- a/packages/core/src/browser/endpoint.spec.ts +++ b/packages/core/src/browser/endpoint.spec.ts @@ -135,13 +135,13 @@ describe('Endpoint', () => { }); -function expectWsUri(options: Endpoint.Options, mockLocation: Endpoint.Location, expectedUri: string) { +function expectWsUri(options: Endpoint.Options, mockLocation: Endpoint.Location, expectedUri: string): void { const cut = new Endpoint(options, mockLocation); const uri = cut.getWebSocketUrl(); expect(uri.toString()).to.eq(expectedUri); } -function expectRestUri(options: Endpoint.Options, mockLocation: Endpoint.Location, expectedUri: string) { +function expectRestUri(options: Endpoint.Options, mockLocation: Endpoint.Location, expectedUri: string): void { const cut = new Endpoint(options, mockLocation); const uri = cut.getRestUrl(); expect(uri.toString()).to.eq(expectedUri); diff --git a/packages/core/src/browser/endpoint.ts b/packages/core/src/browser/endpoint.ts index f2f4eca5d1119..ac26658255ec2 100644 --- a/packages/core/src/browser/endpoint.ts +++ b/packages/core/src/browser/endpoint.ts @@ -39,7 +39,7 @@ export class Endpoint { return new URI(`${this.httpScheme}//${this.host}${this.pathname}${this.path}`); } - protected get pathname() { + protected get pathname(): string { if (this.location.protocol === Endpoint.PROTO_FILE) { return ''; } @@ -52,7 +52,7 @@ export class Endpoint { return this.location.pathname; } - protected get host() { + protected get host(): string { if (this.location.host) { return this.location.host; } @@ -76,7 +76,7 @@ export class Endpoint { })[0] || defaultValue; } - protected get wsScheme() { + protected get wsScheme(): string { return this.httpScheme === Endpoint.PROTO_HTTPS ? Endpoint.PROTO_WSS : Endpoint.PROTO_WS; } @@ -84,7 +84,7 @@ export class Endpoint { * The HTTP/HTTPS scheme of the endpoint, or the user defined one. * See: `Endpoint.Options.httpScheme`. */ - get httpScheme() { + get httpScheme(): string { if (this.options.httpScheme) { return this.options.httpScheme; } @@ -95,7 +95,7 @@ export class Endpoint { return Endpoint.PROTO_HTTP; } - protected get path() { + protected get path(): string { if (this.options.path) { if (this.options.path.startsWith('/')) { return this.options.path; diff --git a/packages/core/src/browser/frontend-application-module.ts b/packages/core/src/browser/frontend-application-module.ts index 499d72fc0f6e4..853e60c402b8d 100644 --- a/packages/core/src/browser/frontend-application-module.ts +++ b/packages/core/src/browser/frontend-application-module.ts @@ -62,7 +62,7 @@ import { DiffUriLabelProviderContribution } from './diff-uris'; import { ApplicationServer, applicationPath } from '../common/application-protocol'; import { WebSocketConnectionProvider } from './messaging'; import { AboutDialog, AboutDialogProps } from './about-dialog'; -import { EnvVariablesServer, envVariablesPath } from './../common/env-variables'; +import { EnvVariablesServer, envVariablesPath, EnvVariable } from './../common/env-variables'; import { FrontendApplicationStateService } from './frontend-application-state'; import { JsonSchemaStore } from './json-schema-store'; import { TabBarToolbarRegistry, TabBarToolbarContribution, TabBarToolbarFactory, TabBarToolbar } from './shell/tab-bar-toolbar'; @@ -206,7 +206,7 @@ export const frontendApplicationModule = new ContainerModule((bind, unbind, isBo // let's reuse a simple and cheap service from this package const envServer: EnvVariablesServer = ctx.container.get(EnvVariablesServer); return { - ping() { + ping(): Promise { return envServer.getValue('does_not_matter'); } }; @@ -275,7 +275,7 @@ export function bindPreferenceService(bind: interfaces.Bind): void { bindPreferenceSchemaProvider(bind); } -export function bindResourceProvider(bind: interfaces.Bind) { +export function bindResourceProvider(bind: interfaces.Bind): void { bind(DefaultResourceProvider).toSelf().inSingletonScope(); bind(ResourceProvider).toProvider(context => uri => context.container.get(DefaultResourceProvider).get(uri)); bindContributionProvider(bind, ResourceResolver); diff --git a/packages/core/src/browser/frontend-application.ts b/packages/core/src/browser/frontend-application.ts index 35fa63094f0e0..b59387f00751c 100644 --- a/packages/core/src/browser/frontend-application.ts +++ b/packages/core/src/browser/frontend-application.ts @@ -82,7 +82,7 @@ export interface FrontendApplicationContribution { @injectable() export abstract class DefaultFrontendApplicationContribution implements FrontendApplicationContribution { - initialize() { + initialize(): void { // NOOP } diff --git a/packages/core/src/browser/keybinding.spec.ts b/packages/core/src/browser/keybinding.spec.ts index 42d93fa671d64..545ba39719746 100644 --- a/packages/core/src/browser/keybinding.spec.ts +++ b/packages/core/src/browser/keybinding.spec.ts @@ -33,7 +33,7 @@ import { ContextKeyService } from './context-key-service'; import * as os from '../common/os'; import * as chai from 'chai'; import * as sinon from 'sinon'; -import { Emitter } from '../common/event'; +import { Emitter, Event } from '../common/event'; disableJSDOM(); @@ -355,7 +355,7 @@ class MockKeyboardLayoutProvider implements KeyboardLayoutProvider { @injectable() class MockKeyboardLayoutChangeNotifier implements KeyboardLayoutChangeNotifier { private emitter = new Emitter(); - get onDidChangeNativeLayout() { + get onDidChangeNativeLayout(): Event { return this.emitter.event; } } diff --git a/packages/core/src/browser/keybinding.ts b/packages/core/src/browser/keybinding.ts index 06052f5b66167..e2405af0e2472 100644 --- a/packages/core/src/browser/keybinding.ts +++ b/packages/core/src/browser/keybinding.ts @@ -16,7 +16,7 @@ import { injectable, inject, named } from 'inversify'; import { isOSX } from '../common/os'; -import { Emitter } from '../common/event'; +import { Emitter, Event } from '../common/event'; import { CommandRegistry } from '../common/command'; import { KeyCode, KeySequence, Key } from './keyboard/keys'; import { KeyboardLayoutService } from './keyboard/keyboard-layout-service'; @@ -158,7 +158,7 @@ export class KeybindingRegistry { * Event that is fired when the resolved keybindings change due to a different keyboard layout * or when a new keymap is being set */ - get onKeybindingsChanged() { + get onKeybindingsChanged(): Event { return this.keybindingsChanged.event; } @@ -168,7 +168,7 @@ export class KeybindingRegistry { * * @param contexts the keybinding contexts to register into the application. */ - protected registerContext(...contexts: KeybindingContext[]) { + protected registerContext(...contexts: KeybindingContext[]): void { for (const context of contexts) { const { id } = context; if (this.contexts[id]) { @@ -184,7 +184,7 @@ export class KeybindingRegistry { * * @param binding */ - registerKeybinding(binding: Keybinding) { + registerKeybinding(binding: Keybinding): void { this.doRegisterKeybinding(binding, KeybindingScope.DEFAULT); } @@ -222,13 +222,13 @@ export class KeybindingRegistry { }); } - protected doRegisterKeybindings(bindings: Keybinding[], scope: KeybindingScope = KeybindingScope.DEFAULT) { + protected doRegisterKeybindings(bindings: Keybinding[], scope: KeybindingScope = KeybindingScope.DEFAULT): void { for (const binding of bindings) { this.doRegisterKeybinding(binding, scope); } } - protected doRegisterKeybinding(binding: Keybinding, scope: KeybindingScope = KeybindingScope.DEFAULT) { + protected doRegisterKeybinding(binding: Keybinding, scope: KeybindingScope = KeybindingScope.DEFAULT): void { try { this.resolveKeybinding(binding); if (this.containsKeybinding(this.keymaps[scope], binding)) { @@ -496,7 +496,7 @@ export class KeybindingRegistry { * * @param keybindings Array of keybindings to be sorted in-place. */ - private sortKeybindingsByPriority(keybindings: Keybinding[]) { + private sortKeybindingsByPriority(keybindings: Keybinding[]): void { keybindings.sort((a: Keybinding, b: Keybinding): number => { let acontext: KeybindingContext | undefined; @@ -539,7 +539,7 @@ export class KeybindingRegistry { * @param event keyboard event. * @return true if the corresponding command was executed false otherwise. */ - protected tryKeybindingExecution(bindings: Keybinding[], event: KeyboardEvent) { + protected tryKeybindingExecution(bindings: Keybinding[], event: KeyboardEvent): boolean { if (bindings.length === 0) { return false; diff --git a/packages/core/src/browser/keyboard/browser-keyboard-frontend-contribution.ts b/packages/core/src/browser/keyboard/browser-keyboard-frontend-contribution.ts index 4a6e055a192aa..6bcfd2de72822 100644 --- a/packages/core/src/browser/keyboard/browser-keyboard-frontend-contribution.ts +++ b/packages/core/src/browser/keyboard/browser-keyboard-frontend-contribution.ts @@ -47,7 +47,7 @@ export class BrowserKeyboardFrontendContribution implements CommandContribution }); } - protected async chooseLayout() { + protected async chooseLayout(): Promise { const current = this.layoutProvider.currentLayoutData; const autodetect: QuickPickItem<'autodetect'> = { label: 'Auto-detect', diff --git a/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.spec.ts b/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.spec.ts index 560a8073123c8..7202409a11e9e 100644 --- a/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.spec.ts +++ b/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.spec.ts @@ -26,7 +26,7 @@ import { WindowService } from '../window/window-service'; import { BrowserKeyboardLayoutProvider } from './browser-keyboard-layout-provider'; import { Key } from './keys'; -describe('browser keyboard layout provider', function () { +describe('browser keyboard layout provider', function (): void { let stubOSX: sinon.SinonStub; let stubWindows: sinon.SinonStub; diff --git a/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.ts b/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.ts index 7e2252352a67c..47a53af5d2019 100644 --- a/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.ts +++ b/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.ts @@ -17,7 +17,7 @@ import { injectable, postConstruct, inject } from 'inversify'; import { IKeyboardLayoutInfo } from 'native-keymap'; import { isOSX } from '../../common/os'; -import { Emitter } from '../../common/event'; +import { Emitter, Event } from '../../common/event'; import { ILogger } from '../../common/logger'; import { Deferred } from '../../common/promise-util'; import { @@ -39,7 +39,7 @@ export class BrowserKeyboardLayoutProvider implements KeyboardLayoutProvider, Ke protected readonly initialized = new Deferred(); protected readonly nativeLayoutChanged = new Emitter(); - get onDidChangeNativeLayout() { + get onDidChangeNativeLayout(): Event { return this.nativeLayoutChanged.event; } @@ -47,15 +47,15 @@ export class BrowserKeyboardLayoutProvider implements KeyboardLayoutProvider, Ke protected source: KeyboardLayoutSource = 'pressed-keys'; protected currentLayout: KeyboardLayoutData = DEFAULT_LAYOUT_DATA; - get allLayoutData() { + get allLayoutData(): KeyboardLayoutData[] { return this.tester.candidates.slice(); } - get currentLayoutData() { + get currentLayoutData(): KeyboardLayoutData { return this.currentLayout; } - get currentLayoutSource() { + get currentLayoutSource(): KeyboardLayoutSource { return this.source; } @@ -267,7 +267,7 @@ export class KeyboardTester { private readonly testedInputs = new Map(); - get inputCount() { + get inputCount(): number { return this.testedInputs.size; } diff --git a/packages/core/src/browser/keyboard/keyboard-layout-service.spec.ts b/packages/core/src/browser/keyboard/keyboard-layout-service.spec.ts index 97c5668ca6d31..4dd69127c066f 100644 --- a/packages/core/src/browser/keyboard/keyboard-layout-service.spec.ts +++ b/packages/core/src/browser/keyboard/keyboard-layout-service.spec.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { Container, injectable } from 'inversify'; -import { Emitter } from '../../common/event'; +import { Emitter, Event } from '../../common/event'; import { KeyCode } from './keys'; import { KeyboardLayoutService } from './keyboard-layout-service'; import { KeyboardLayoutProvider, NativeKeyboardLayout, KeyboardLayoutChangeNotifier } from '../../common/keyboard/keyboard-layout-provider'; @@ -23,7 +23,7 @@ import * as os from '../../common/os'; import * as chai from 'chai'; import * as sinon from 'sinon'; -describe('keyboard layout service', function () { +describe('keyboard layout service', function (): void { let stubOSX: sinon.SinonStub; let stubWindows: sinon.SinonStub; @@ -47,7 +47,7 @@ describe('keyboard layout service', function () { @injectable() class MockLayoutProvider implements KeyboardLayoutProvider, KeyboardLayoutChangeNotifier { emitter = new Emitter(); - get onDidChangeNativeLayout() { + get onDidChangeNativeLayout(): Event { return this.emitter.event; } getNativeLayout(): Promise { diff --git a/packages/core/src/browser/keyboard/keyboard-layout-service.ts b/packages/core/src/browser/keyboard/keyboard-layout-service.ts index 35c3c744b38a1..0fd5956d154cf 100644 --- a/packages/core/src/browser/keyboard/keyboard-layout-service.ts +++ b/packages/core/src/browser/keyboard/keyboard-layout-service.ts @@ -20,7 +20,7 @@ import { isWindows } from '../../common/os'; import { NativeKeyboardLayout, KeyboardLayoutProvider, KeyboardLayoutChangeNotifier, KeyValidator } from '../../common/keyboard/keyboard-layout-provider'; -import { Emitter } from '../../common/event'; +import { Emitter, Event } from '../../common/event'; import { KeyCode, Key } from './keys'; export interface KeyboardLayout { @@ -59,7 +59,7 @@ export class KeyboardLayoutService { protected keyboardLayoutChanged = new Emitter(); - get onKeyboardLayoutChanged() { + get onKeyboardLayoutChanged(): Event { return this.keyboardLayoutChanged.event; } @@ -196,7 +196,7 @@ export class KeyboardLayoutService { } } - private addWindowsKeyMapping(key2KeyCode: KeyCode[], mappedKey: Key, vkey: string, value: string) { + private addWindowsKeyMapping(key2KeyCode: KeyCode[], mappedKey: Key, vkey: string, value: string): void { const key = VKEY_TO_KEY[vkey]; if (key) { const index = this.getCharacterIndex(key); diff --git a/packages/core/src/browser/keyboard/keys.ts b/packages/core/src/browser/keyboard/keys.ts index eddefb1475b03..3dcb4e4090028 100644 --- a/packages/core/src/browser/keyboard/keys.ts +++ b/packages/core/src/browser/keyboard/keys.ts @@ -19,7 +19,7 @@ import { isOSX } from '../../common/os'; export type KeySequence = KeyCode[]; export namespace KeySequence { - export function equals(a: KeySequence, b: KeySequence) { + export function equals(a: KeySequence, b: KeySequence): boolean { if (a.length !== b.length) { return false; } @@ -137,7 +137,7 @@ export class KeyCode { /** * Return true if this KeyCode only contains modifiers. */ - public isModifierOnly() { + public isModifierOnly(): boolean { return this.key === undefined; } @@ -222,7 +222,7 @@ export class KeyCode { private static keybindings: { [key: string]: KeyCode } = {}; /* Reset the key hashmap, this is for testing purposes. */ - public static resetKeyBindings() { + public static resetKeyBindings(): void { KeyCode.keybindings = {}; } @@ -295,7 +295,7 @@ export namespace KeyCode { /* * Return true if the string is a modifier M1 to M4. */ - export function isModifierString(key: string) { + export function isModifierString(key: string): boolean { return key === KeyModifier.CtrlCmd || key === KeyModifier.Shift || key === KeyModifier.Alt diff --git a/packages/core/src/browser/label-provider.spec.ts b/packages/core/src/browser/label-provider.spec.ts index 0abdef2b696af..dc5dd6c37b64f 100644 --- a/packages/core/src/browser/label-provider.spec.ts +++ b/packages/core/src/browser/label-provider.spec.ts @@ -18,30 +18,30 @@ import { expect } from 'chai'; import { DefaultUriLabelProviderContribution, FOLDER_ICON } from './label-provider'; import URI from '../common/uri'; -describe('DefaultUriLabelProviderContribution', function () { +describe('DefaultUriLabelProviderContribution', function (): void { - it('should return a short name', function () { + it('should return a short name', function (): void { const prov = new DefaultUriLabelProviderContribution(); const shortName = prov.getName(new URI('file:///tmp/hello/you.txt')); expect(shortName).eq('you.txt'); }); - it('should return a long name', function () { + it('should return a long name', function (): void { const prov = new DefaultUriLabelProviderContribution(); const longName = prov.getLongName(new URI('file:///tmp/hello/you.txt')); expect(longName).eq('/tmp/hello/you.txt'); }); - it('should return icon class for something that seems to be a file', function () { + it('should return icon class for something that seems to be a file', function (): void { const prov = new DefaultUriLabelProviderContribution(); const icon = prov.getIcon(new URI('file:///tmp/hello/you.txt')); expect(icon).eq('text-icon medium-blue'); }); - it('should return icon class for something that seems to be a directory', function () { + it('should return icon class for something that seems to be a directory', function (): void { const prov = new DefaultUriLabelProviderContribution(); const icon = prov.getIcon(new URI('file:///tmp/hello')); diff --git a/packages/core/src/browser/logger-frontend-module.ts b/packages/core/src/browser/logger-frontend-module.ts index 314d2dbfa5a37..c3fe7adafaf1b 100644 --- a/packages/core/src/browser/logger-frontend-module.ts +++ b/packages/core/src/browser/logger-frontend-module.ts @@ -23,7 +23,7 @@ import { FrontendApplicationContribution } from './frontend-application'; export const loggerFrontendModule = new ContainerModule(bind => { bind(FrontendApplicationContribution).toDynamicValue(ctx => ({ - initialize() { + initialize(): void { setRootLogger(ctx.container.get(ILogger)); } })); diff --git a/packages/core/src/browser/opener-service.spec.ts b/packages/core/src/browser/opener-service.spec.ts index 90c806e7b0c87..64c7641e73994 100644 --- a/packages/core/src/browser/opener-service.spec.ts +++ b/packages/core/src/browser/opener-service.spec.ts @@ -16,15 +16,16 @@ import { DefaultOpenerService, OpenHandler } from './opener-service'; import * as assert from 'assert'; +import { MaybePromise } from '../common/types'; const id = 'my-opener'; const openHandler: OpenHandler = { id, label: 'My Opener', - canHandle() { + canHandle(): MaybePromise { return Promise.resolve(1); }, - open() { + open(): MaybePromise { return Promise.resolve(undefined); } }; diff --git a/packages/core/src/browser/preferences/preference-provider.ts b/packages/core/src/browser/preferences/preference-provider.ts index 1cd1e47d5d856..d331a8058de6e 100644 --- a/packages/core/src/browser/preferences/preference-provider.ts +++ b/packages/core/src/browser/preferences/preference-provider.ts @@ -105,7 +105,7 @@ export abstract class PreferenceProvider implements Disposable { * Resolved when the preference provider is ready to provide preferences * It should be resolved by subclasses. */ - get ready() { + get ready(): Promise { return this._ready.promise; } diff --git a/packages/core/src/browser/preferences/preference-proxy.spec.ts b/packages/core/src/browser/preferences/preference-proxy.spec.ts index 150b49e143c80..c74b1ebf68979 100644 --- a/packages/core/src/browser/preferences/preference-proxy.spec.ts +++ b/packages/core/src/browser/preferences/preference-proxy.spec.ts @@ -18,9 +18,9 @@ import { createPreferenceProxy } from './preference-proxy'; import { MockPreferenceService } from './test/mock-preference-service'; import { expect } from 'chai'; -describe('preference proxy', function () { +describe('preference proxy', function (): void { /** Verify the return type of the ready property. */ - it('.ready should return a promise', function () { + it('.ready should return a promise', function (): void { const proxy = createPreferenceProxy(new MockPreferenceService(), { properties: {} diff --git a/packages/core/src/browser/preferences/preference-service.ts b/packages/core/src/browser/preferences/preference-service.ts index 9288189b07312..28510288a7d4d 100644 --- a/packages/core/src/browser/preferences/preference-service.ts +++ b/packages/core/src/browser/preferences/preference-service.ts @@ -42,13 +42,13 @@ export class PreferenceChangeImpl implements PreferenceChange { private change: PreferenceProviderDataChange ) { } - get preferenceName() { + get preferenceName(): string { return this.change.preferenceName; } - get newValue() { + get newValue(): string { return this.change.newValue; } - get oldValue() { + get oldValue(): string { return this.change.oldValue; } get scope(): PreferenceScope { diff --git a/packages/core/src/browser/preferences/test/mock-preference-provider.ts b/packages/core/src/browser/preferences/test/mock-preference-provider.ts index d7a28139d0ee3..9c6fc9155ea48 100644 --- a/packages/core/src/browser/preferences/test/mock-preference-provider.ts +++ b/packages/core/src/browser/preferences/test/mock-preference-provider.ts @@ -24,7 +24,7 @@ import { PreferenceScope } from '../preference-scope'; export class MockPreferenceProvider extends PreferenceProvider { readonly prefs: { [p: string]: any } = {}; - getPreferences() { + getPreferences(): { [p: string]: any } { return this.prefs; } async setPreference(preferenceName: string, newValue: any, resourceUri?: string): Promise { diff --git a/packages/core/src/browser/preferences/test/mock-preference-proxy.ts b/packages/core/src/browser/preferences/test/mock-preference-proxy.ts index d64e26c9f910e..3df7bdfa7b946 100644 --- a/packages/core/src/browser/preferences/test/mock-preference-proxy.ts +++ b/packages/core/src/browser/preferences/test/mock-preference-proxy.ts @@ -18,7 +18,7 @@ import { Emitter } from '../../../common'; import { PreferenceChange } from '../preference-service'; // tslint:disable:no-any -export function createMockPreferenceProxy(preferences: { [p: string]: any }) { +export function createMockPreferenceProxy(preferences: { [p: string]: any }): any { const unsupportedOperation = (_: any, __: string) => { throw new Error('Unsupported operation'); }; diff --git a/packages/core/src/browser/preferences/test/mock-preference-service.ts b/packages/core/src/browser/preferences/test/mock-preference-service.ts index b01f48e1f0bc7..9841e2ef41f8d 100644 --- a/packages/core/src/browser/preferences/test/mock-preference-service.ts +++ b/packages/core/src/browser/preferences/test/mock-preference-service.ts @@ -23,7 +23,7 @@ import URI from '../../../common/uri'; @injectable() export class MockPreferenceService implements PreferenceService { constructor() { } - dispose() { } + dispose(): void { } get(preferenceName: string): T | undefined; get(preferenceName: string, defaultValue: T): T; get(preferenceName: string, defaultValue: T, resourceUri: string): T; diff --git a/packages/core/src/browser/quick-open/quick-command-service.ts b/packages/core/src/browser/quick-open/quick-command-service.ts index 42bac4e5a3b15..83a5b942793d4 100644 --- a/packages/core/src/browser/quick-open/quick-command-service.ts +++ b/packages/core/src/browser/quick-open/quick-command-service.ts @@ -51,7 +51,7 @@ export class QuickCommandService implements QuickOpenModel, QuickOpenHandler { protected readonly corePreferences: CorePreferences; protected readonly contexts = new Map(); - pushCommandContext(commandId: string, when: string) { + pushCommandContext(commandId: string, when: string): void { const contexts = this.contexts.get(commandId) || []; contexts.push(when); this.contexts.set(commandId, contexts); @@ -220,7 +220,7 @@ export class CommandQuickOpenItem extends QuickOpenGroupItem { return this.hidden; } - getIconClass() { + getIconClass(): string | undefined { const toggleHandler = this.commands.getToggledHandler(this.command.id); if (toggleHandler && toggleHandler.isToggled && toggleHandler.isToggled()) { return 'fa fa-check'; diff --git a/packages/core/src/browser/saveable.ts b/packages/core/src/browser/saveable.ts index 921e648182fa9..0a725c94238fb 100644 --- a/packages/core/src/browser/saveable.ts +++ b/packages/core/src/browser/saveable.ts @@ -169,7 +169,7 @@ export class ShouldSaveDialog extends AbstractDialog { this.appendAcceptButton('Save'); } - protected appendDontSaveButton() { + protected appendDontSaveButton(): HTMLButtonElement { const button = this.createButton("Don't save"); this.controlPanel.appendChild(button); button.classList.add('secondary'); diff --git a/packages/core/src/browser/shell/application-shell.ts b/packages/core/src/browser/shell/application-shell.ts index 66c3b901d6386..111f3361676bb 100644 --- a/packages/core/src/browser/shell/application-shell.ts +++ b/packages/core/src/browser/shell/application-shell.ts @@ -270,7 +270,7 @@ export class ApplicationShell extends Widget { } } - protected onDragEnter({ mimeData }: IDragEvent) { + protected onDragEnter({ mimeData }: IDragEvent): void { if (!this.dragState) { if (mimeData && mimeData.hasData('application/vnd.phosphor.widget-factory')) { // The drag contains a widget, so we'll track it and expand side panels as needed @@ -284,7 +284,7 @@ export class ApplicationShell extends Widget { } } - protected onDragOver(event: IDragEvent) { + protected onDragOver(event: IDragEvent): void { const state = this.dragState; if (state) { state.lastDragOver = event; @@ -351,7 +351,7 @@ export class ApplicationShell extends Widget { } } - protected onDrop(event: IDragEvent) { + protected onDrop(event: IDragEvent): void { const state = this.dragState; if (state) { if (state.leaveTimeout) { @@ -373,7 +373,7 @@ export class ApplicationShell extends Widget { } } - protected onDragLeave(event: IDragEvent) { + protected onDragLeave(event: IDragEvent): void { const state = this.dragState; if (state) { state.lastDragOver = undefined; @@ -598,7 +598,7 @@ export class ApplicationShell extends Widget { } } - protected getValidatedLayoutData(layoutData: ApplicationShell.LayoutData) { + protected getValidatedLayoutData(layoutData: ApplicationShell.LayoutData): ApplicationShell.LayoutData { if (layoutData.version !== LAYOUT_DATA_VERSION) { throw new Error(`Saved workbench layout (version ${layoutData.version || 'unknown'}) is incompatible with the current (${LAYOUT_DATA_VERSION})`); } @@ -853,7 +853,7 @@ export class ApplicationShell extends Widget { /** * Set the z-index of the given element and its ancestors to the value `z`. */ - private setZIndex(element: HTMLElement, z: string | null) { + private setZIndex(element: HTMLElement, z: string | null): void { element.style.zIndex = z; const parent = element.parentElement; if (parent && parent !== this.node) { @@ -1163,7 +1163,7 @@ export class ApplicationShell extends Widget { * Refresh the toggle button for the bottom panel. This implementation creates a status bar entry * and refers to the command `core.toggle.bottom.panel`. */ - protected refreshBottomPanelToggleButton() { + protected refreshBottomPanelToggleButton(): void { if (this.bottomPanel.isEmpty) { this.statusBar.removeElement(BOTTOM_PANEL_TOGGLE_ID); } else { diff --git a/packages/core/src/browser/shell/shell-layout-restorer.ts b/packages/core/src/browser/shell/shell-layout-restorer.ts index 9e1f5718176b3..9352652b61e71 100644 --- a/packages/core/src/browser/shell/shell-layout-restorer.ts +++ b/packages/core/src/browser/shell/shell-layout-restorer.ts @@ -100,11 +100,11 @@ export class ShellLayoutRestorer implements CommandContribution { return true; } - protected isWidgetProperty(propertyName: string) { + protected isWidgetProperty(propertyName: string): boolean { return propertyName === 'widget'; } - protected isWidgetsProperty(propertyName: string) { + protected isWidgetsProperty(propertyName: string): boolean { return propertyName === 'widgets'; } diff --git a/packages/core/src/browser/storage-service.ts b/packages/core/src/browser/storage-service.ts index 0f0f043b9e9ee..90af927965d66 100644 --- a/packages/core/src/browser/storage-service.ts +++ b/packages/core/src/browser/storage-service.ts @@ -51,7 +51,7 @@ export class LocalStorageService implements StorageService { @inject(WindowService) protected readonly windowService: WindowService; @postConstruct() - protected init() { + protected init(): void { if (typeof window !== 'undefined' && window.localStorage) { this.storage = window.localStorage; this.testLocalStorage(); diff --git a/packages/core/src/browser/test/jsdom.ts b/packages/core/src/browser/test/jsdom.ts index eccb60a2c067a..3d5837e082681 100644 --- a/packages/core/src/browser/test/jsdom.ts +++ b/packages/core/src/browser/test/jsdom.ts @@ -51,7 +51,7 @@ export function enableJSDOM(): () => void { toCleanup.push(property); } }); - (dom.window.document as any)['queryCommandSupported'] = function () { }; + (dom.window.document as any)['queryCommandSupported'] = function (): void { }; const disableJSDOM = (global as any)['_disableJSDOM'] = () => { let property: string | undefined; diff --git a/packages/core/src/browser/test/mock-storage-service.ts b/packages/core/src/browser/test/mock-storage-service.ts index 03b14010062a9..28ef75b417f6c 100644 --- a/packages/core/src/browser/test/mock-storage-service.ts +++ b/packages/core/src/browser/test/mock-storage-service.ts @@ -28,7 +28,7 @@ export class MockStorageService implements StorageService { onSetDataCallback?: (key: string, data?: any) => void; // tslint:disable-next-line:no-any - onSetData(callback: (key: string, data?: any) => void) { + onSetData(callback: (key: string, data?: any) => void): void { this.onSetDataCallback = callback; } diff --git a/packages/core/src/browser/theming.ts b/packages/core/src/browser/theming.ts index 173323e6c0ab1..a5c4c51473901 100644 --- a/packages/core/src/browser/theming.ts +++ b/packages/core/src/browser/theming.ts @@ -146,7 +146,7 @@ export class ThemingCommandContribution implements CommandContribution, MenuCont commands.registerCommand(this, this); } - registerMenus(menus: MenuModelRegistry) { + registerMenus(menus: MenuModelRegistry): void { menus.registerMenuAction(CommonMenus.FILE_SETTINGS_SUBMENU_THEME, { commandId: this.id, label: this.label, @@ -154,7 +154,7 @@ export class ThemingCommandContribution implements CommandContribution, MenuCont }); } - execute() { + execute(): void { this.resetTo = this.themeService.getCurrentTheme().id; this.openService.open(this, { placeholder: 'Select Color Theme (Up/Down Keys to Preview)', @@ -168,7 +168,7 @@ export class ThemingCommandContribution implements CommandContribution, MenuCont }); } - private activeIndex() { + private activeIndex(): number { const current = this.themeService.getCurrentTheme().id; const themes = this.themeService.getThemes(); return themes.findIndex(theme => theme.id === current); @@ -202,10 +202,10 @@ export class BuiltinThemeProvider { label: 'Dark Theme', description: 'Bright fonts on dark backgrounds.', editorTheme: 'dark-plus', // loaded in /packages/monaco/src/browser/textmate/monaco-theme-registry.ts - activate() { + activate(): void { BuiltinThemeProvider.darkCss.use(); }, - deactivate() { + deactivate(): void { BuiltinThemeProvider.darkCss.unuse(); } }; @@ -215,10 +215,10 @@ export class BuiltinThemeProvider { label: 'Light Theme', description: 'Dark fonts on light backgrounds.', editorTheme: 'light-plus', // loaded in /packages/monaco/src/browser/textmate/monaco-theme-registry.ts - activate() { + activate(): void { BuiltinThemeProvider.lightCss.use(); }, - deactivate() { + deactivate(): void { BuiltinThemeProvider.lightCss.unuse(); } }; diff --git a/packages/core/src/browser/tree/fuzzy-search.spec.ts b/packages/core/src/browser/tree/fuzzy-search.spec.ts index 8718a875e766c..3bea6698b6ef2 100644 --- a/packages/core/src/browser/tree/fuzzy-search.spec.ts +++ b/packages/core/src/browser/tree/fuzzy-search.spec.ts @@ -80,11 +80,11 @@ describe('fuzzy-search', () => { }); }); - function expectOrder(actual: FuzzySearch.Match[], expected: string[]) { + function expectOrder(actual: FuzzySearch.Match[], expected: string[]): void { expect(actual.map(result => result.item)).to.be.deep.equal(expected); } - function expectSearch(actual: FuzzySearch.Match[], expected: FuzzySearch.Match[]) { + function expectSearch(actual: FuzzySearch.Match[], expected: FuzzySearch.Match[]): void { expect(actual).to.be.deep.equal(expected); } diff --git a/packages/core/src/browser/tree/search-box-debounce.ts b/packages/core/src/browser/tree/search-box-debounce.ts index 4012cd09166e7..2aa1a1923ccbc 100644 --- a/packages/core/src/browser/tree/search-box-debounce.ts +++ b/packages/core/src/browser/tree/search-box-debounce.ts @@ -84,11 +84,11 @@ export class SearchBoxDebounce implements Disposable { this.disposables.dispose(); } - protected fireChanged(value: string | undefined) { + protected fireChanged(value: string | undefined): void { this.emitter.fire(value); } - protected reset() { + protected reset(): void { this.state = undefined; this.fireChanged(undefined); } diff --git a/packages/core/src/browser/tree/search-box.ts b/packages/core/src/browser/tree/search-box.ts index c0584f0a5875c..6d9051ed9afcd 100644 --- a/packages/core/src/browser/tree/search-box.ts +++ b/packages/core/src/browser/tree/search-box.ts @@ -123,11 +123,11 @@ export class SearchBox extends BaseWidget { } } - protected handleArrowUp() { + protected handleArrowUp(): void { this.firePrevious(); } - protected handleArrowDown() { + protected handleArrowDown(): void { this.fireNext(); } @@ -136,7 +136,7 @@ export class SearchBox extends BaseWidget { this.fireClose(); } - protected handleKey(keyCode: KeyCode) { + protected handleKey(keyCode: KeyCode): void { const character = Key.equals(Key.BACKSPACE, keyCode) ? '\b' : keyCode.character; const data = this.debounce.append(character); if (data) { diff --git a/packages/core/src/browser/tree/tree-decorator.ts b/packages/core/src/browser/tree/tree-decorator.ts index c1adc16a8bcc7..d0c5f92142b60 100644 --- a/packages/core/src/browser/tree/tree-decorator.ts +++ b/packages/core/src/browser/tree/tree-decorator.ts @@ -88,7 +88,8 @@ export class NoopTreeDecoratorService implements TreeDecoratorService { this.emitter.dispose(); } - getDecorations() { + // tslint:disable-next-line:no-any + getDecorations(): Map { return new Map(); } diff --git a/packages/core/src/browser/tree/tree-expansion.ts b/packages/core/src/browser/tree/tree-expansion.ts index 56af8b98d0b74..c1e2de27fcb94 100644 --- a/packages/core/src/browser/tree/tree-expansion.ts +++ b/packages/core/src/browser/tree/tree-expansion.ts @@ -95,7 +95,7 @@ export class TreeExpansionServiceImpl implements TreeExpansionService { }); } - dispose() { + dispose(): void { this.onExpansionChangedEmitter.dispose(); } diff --git a/packages/core/src/browser/tree/tree-iterator.spec.ts b/packages/core/src/browser/tree/tree-iterator.spec.ts index a50d63792c863..392ef888d8c27 100644 --- a/packages/core/src/browser/tree/tree-iterator.spec.ts +++ b/packages/core/src/browser/tree/tree-iterator.spec.ts @@ -155,7 +155,7 @@ describe('iterators', () => { expect(array).to.be.empty; }); - it('cycle - without start', function () { + it('cycle - without start', function (): void { this.timeout(1000); const array = [1, 2, 3, 4]; const itr = Iterators.cycle(array); @@ -173,7 +173,7 @@ describe('iterators', () => { } }); - it('cycle - with start', function () { + it('cycle - with start', function (): void { this.timeout(1000); const array = [1, 2, 3, 4]; const itr = Iterators.cycle(array, 2); diff --git a/packages/core/src/browser/tree/tree-iterator.ts b/packages/core/src/browser/tree/tree-iterator.ts index 1d78d1e86ac85..dd8470fd9459f 100644 --- a/packages/core/src/browser/tree/tree-iterator.ts +++ b/packages/core/src/browser/tree/tree-iterator.ts @@ -47,6 +47,7 @@ export abstract class AbstractTreeIterator implements TreeIterator, Iterable & WaitUntilEvent> { return this.tree.onNodeRefreshed; } - getNode(id: string | undefined) { + getNode(id: string | undefined): TreeNode | undefined { return this.tree.getNode(id); } - validateNode(node: TreeNode | undefined) { + validateNode(node: TreeNode | undefined): TreeNode | undefined { return this.tree.validateNode(node); } @@ -213,15 +213,17 @@ export class TreeModelImpl implements TreeModel, SelectionProvider> { return this.expansionService.onExpansionChanged; } @@ -413,7 +415,7 @@ export class TreeModelImpl implements TreeModel, SelectionProvider> = []; @postConstruct() - init() { + init(): void { this.disposables.push(this.filteredNodesEmitter); } @@ -83,7 +83,7 @@ export class TreeSearch implements Disposable { return this.filteredNodesEmitter.event; } - dispose() { + dispose(): void { this.disposables.dispose(); } diff --git a/packages/core/src/browser/tree/tree-selection-impl.ts b/packages/core/src/browser/tree/tree-selection-impl.ts index eeb93493fc5f6..337a8a3c9aa73 100644 --- a/packages/core/src/browser/tree/tree-selection-impl.ts +++ b/packages/core/src/browser/tree/tree-selection-impl.ts @@ -34,7 +34,7 @@ export class TreeSelectionServiceImpl implements TreeSelectionService { this.state = new TreeSelectionState(this.tree); } - dispose() { + dispose(): void { this.onSelectionChangedEmitter.dispose(); } diff --git a/packages/core/src/browser/tree/tree-widget-selection.ts b/packages/core/src/browser/tree/tree-widget-selection.ts index 0868c0f541495..ea94af7cd66c8 100644 --- a/packages/core/src/browser/tree/tree-widget-selection.ts +++ b/packages/core/src/browser/tree/tree-widget-selection.ts @@ -21,7 +21,7 @@ export type TreeWidgetSelection = ReadonlyArray> & source: TreeWidget }; export namespace TreeWidgetSelection { - export function isSource(selection: Object | undefined, source: TreeWidget) { + export function isSource(selection: Object | undefined, source: TreeWidget): boolean { return getSource(selection) === source; } export function getSource(selection: Object | undefined): TreeWidget | undefined { diff --git a/packages/core/src/browser/tree/tree-widget.tsx b/packages/core/src/browser/tree/tree-widget.tsx index 13bc934a7cfa1..9b910536d60ed 100644 --- a/packages/core/src/browser/tree/tree-widget.tsx +++ b/packages/core/src/browser/tree/tree-widget.tsx @@ -400,7 +400,7 @@ export class TreeWidget extends ReactWidget implements StatefulWidget { } protected readonly toggle = (event: React.MouseEvent) => this.doToggle(event); - protected doToggle(event: React.MouseEvent) { + protected doToggle(event: React.MouseEvent): void { const nodeId = event.currentTarget.getAttribute('data-node-id'); if (nodeId) { const node = this.model.getNode(nodeId); @@ -500,7 +500,7 @@ export class TreeWidget extends ReactWidget implements StatefulWidget { return this.getDecorationData(node, 'captionSuffixes').filter(notEmpty).reduce((acc, current) => acc.concat(current), []).length > 0; } - protected applyFontStyles(original: React.CSSProperties, fontData: TreeDecoration.FontData | undefined) { + protected applyFontStyles(original: React.CSSProperties, fontData: TreeDecoration.FontData | undefined): React.CSSProperties { if (fontData === undefined) { return original; } diff --git a/packages/core/src/browser/view-container.ts b/packages/core/src/browser/view-container.ts index d14fdf6abeb4b..184c74d7e858f 100644 --- a/packages/core/src/browser/view-container.ts +++ b/packages/core/src/browser/view-container.ts @@ -434,7 +434,7 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica * Register a menu action to toggle the visibility of the new part. * The menu action is unregistered first to enable refreshing the order of menu actions. */ - protected refreshMenu(part: ViewContainerPart) { + protected refreshMenu(part: ViewContainerPart): void { const commandId = this.toggleVisibilityCommandId(part); this.menuRegistry.unregisterMenuAction(commandId); if (!part.wrapped.title.label) { @@ -697,7 +697,7 @@ export class ViewContainerPart extends BaseWidget { this.collapsedEmitter.fire(collapsed); } - get canHide() { + get canHide(): boolean { return this.options.canHide === undefined || this.options.canHide; } diff --git a/packages/core/src/browser/widget-manager.ts b/packages/core/src/browser/widget-manager.ts index 455636113b866..ec1cb61ad5bb8 100644 --- a/packages/core/src/browser/widget-manager.ts +++ b/packages/core/src/browser/widget-manager.ts @@ -158,7 +158,7 @@ export class WidgetManager { return undefined; } - protected toKey(options: WidgetConstructionOptions) { + protected toKey(options: WidgetConstructionOptions): string { return JSON.stringify(options); } diff --git a/packages/core/src/browser/widgets/react-renderer.tsx b/packages/core/src/browser/widgets/react-renderer.tsx index 1cba44c1396ba..d75f02e0aaa60 100644 --- a/packages/core/src/browser/widgets/react-renderer.tsx +++ b/packages/core/src/browser/widgets/react-renderer.tsx @@ -26,7 +26,7 @@ export class ReactRenderer implements Disposable { this.host = host || document.createElement('div'); } - dispose() { + dispose(): void { ReactDOM.unmountComponentAtNode(this.host); } diff --git a/packages/core/src/browser/widgets/virtual-renderer.ts b/packages/core/src/browser/widgets/virtual-renderer.ts index 706e2602117b5..18f6cf5bbd8ba 100644 --- a/packages/core/src/browser/widgets/virtual-renderer.ts +++ b/packages/core/src/browser/widgets/virtual-renderer.ts @@ -43,7 +43,7 @@ export namespace VirtualRenderer { /* * @deprecated use ReactDOM.render instead. VirtualRenderer will be removed with the next major release. */ - export function render(child: h.Child, host: HTMLElement) { + export function render(child: h.Child, host: HTMLElement): void { const content = toContent(child); VirtualDOM.render(content, host); } diff --git a/packages/core/src/browser/window/test/mock-window-service.ts b/packages/core/src/browser/window/test/mock-window-service.ts index 839e1288016f7..a0662fcfde2a1 100644 --- a/packages/core/src/browser/window/test/mock-window-service.ts +++ b/packages/core/src/browser/window/test/mock-window-service.ts @@ -18,6 +18,6 @@ import { WindowService } from '../window-service'; @injectable() export class MockWindowService implements WindowService { - openNewWindow() { return undefined; } - canUnload() { return true; } + openNewWindow(): undefined { return undefined; } + canUnload(): boolean { return true; } } diff --git a/packages/core/src/common/cancellation.ts b/packages/core/src/common/cancellation.ts index 1ad96051c5cc6..ee450c2cfdb80 100644 --- a/packages/core/src/common/cancellation.ts +++ b/packages/core/src/common/cancellation.ts @@ -32,7 +32,7 @@ export interface CancellationToken { // tslint:disable-next-line:no-any const shortcutEvent: Event = Object.freeze(Object.assign(function (callback: any, context?: any): any { const handle = setTimeout(callback.bind(context), 0); - return { dispose() { clearTimeout(handle); } }; + return { dispose(): void { clearTimeout(handle); } }; }, { maxListeners: 0 })); export namespace CancellationToken { @@ -53,7 +53,7 @@ class MutableToken implements CancellationToken { private _isCancelled: boolean = false; private _emitter: Emitter | undefined; - public cancel() { + public cancel(): void { if (!this._isCancelled) { this._isCancelled = true; if (this._emitter) { diff --git a/packages/core/src/common/command.spec.ts b/packages/core/src/common/command.spec.ts index 412915814446a..192d502ad741e 100644 --- a/packages/core/src/common/command.spec.ts +++ b/packages/core/src/common/command.spec.ts @@ -129,7 +129,7 @@ class EmptyContributionProvider implements ContributionProvider { concat += element; @@ -139,5 +139,5 @@ class ConcatCommandHandler implements CommandHandler { } class StubCommandHandler implements CommandHandler { - execute(...args: string[]) { return undefined; } + execute(...args: string[]): undefined { return undefined; } } diff --git a/packages/core/src/common/event.ts b/packages/core/src/common/event.ts index 9a32332c2a6e6..c605955adc755 100644 --- a/packages/core/src/common/event.ts +++ b/packages/core/src/common/event.ts @@ -41,8 +41,8 @@ export interface Event { } export namespace Event { - const _disposable = { dispose() { } }; - export const None: Event = Object.assign(function () { return _disposable; }, { + const _disposable = { dispose(): void { } }; + export const None: Event = Object.assign(function (): { dispose(): void } { return _disposable; }, { get maxListeners(): number { return 0; }, set maxListeners(maxListeners: number) { } }); @@ -108,6 +108,7 @@ class CallbackList implements Iterable { } } + // tslint:disable-next-line:typedef public [Symbol.iterator]() { if (!this._callbacks) { return [][Symbol.iterator](); @@ -149,7 +150,7 @@ export interface EmitterOptions { export class Emitter { - private static _noop = function () { }; + private static _noop = function (): void { }; private _event: Event; private _callbacks: CallbackList | undefined; @@ -235,7 +236,7 @@ export class Emitter { } } - dispose() { + dispose(): void { if (this._callbacks) { this._callbacks.dispose(); this._callbacks = undefined; diff --git a/packages/core/src/common/logger-watcher.ts b/packages/core/src/common/logger-watcher.ts index 695e1a9613f03..0e72c077820d7 100644 --- a/packages/core/src/common/logger-watcher.ts +++ b/packages/core/src/common/logger-watcher.ts @@ -24,7 +24,7 @@ export class LoggerWatcher { getLoggerClient(): ILoggerClient { const emitter = this.onLogLevelChangedEmitter; return { - onLogLevelChanged(event: ILogLevelChangedEvent) { + onLogLevelChanged(event: ILogLevelChangedEvent): void { emitter.fire(event); } }; @@ -37,7 +37,7 @@ export class LoggerWatcher { } // FIXME: get rid of it, backend services should as well set a client on the server - fireLogLevelChanged(event: ILogLevelChangedEvent) { + fireLogLevelChanged(event: ILogLevelChangedEvent): void { this.onLogLevelChangedEmitter.fire(event); } } diff --git a/packages/core/src/common/logger.ts b/packages/core/src/common/logger.ts index a9901004bec51..97991a7b6c654 100644 --- a/packages/core/src/common/logger.ts +++ b/packages/core/src/common/logger.ts @@ -32,7 +32,7 @@ export let logger: ILogger; * Invoking has no side-effect if `setRootLogger` was not called before. Multiple function invocation has * no side-effect either. */ -export function unsetRootLogger() { +export function unsetRootLogger(): void { if (logger !== undefined) { ConsoleLogger.reset(); (logger) = undefined; diff --git a/packages/core/src/common/menu.spec.ts b/packages/core/src/common/menu.spec.ts index ba32c10fa93a9..48753cb3f1dc4 100644 --- a/packages/core/src/common/menu.spec.ts +++ b/packages/core/src/common/menu.spec.ts @@ -37,7 +37,7 @@ describe('menu-model-registry', () => { }); } }, { - registerCommands(reg: CommandRegistry) { + registerCommands(reg: CommandRegistry): void { reg.registerCommand({ id: 'open', label: 'A' @@ -64,7 +64,7 @@ describe('menu-model-registry', () => { }); }); -function createMenuRegistry(menuContrib: MenuContribution, commandContrib: CommandContribution) { +function createMenuRegistry(menuContrib: MenuContribution, commandContrib: CommandContribution): MenuModelRegistry { const cmdReg = new CommandRegistry({ getContributions: () => [commandContrib] }); cmdReg.onStart(); const menuReg = new MenuModelRegistry({ getContributions: () => [menuContrib] }, cmdReg); diff --git a/packages/core/src/common/menu.ts b/packages/core/src/common/menu.ts index 94c169770a895..2178b0ad94abe 100644 --- a/packages/core/src/common/menu.ts +++ b/packages/core/src/common/menu.ts @@ -204,7 +204,7 @@ export class CompositeMenuNode implements MenuNode { }; } - public removeNode(id: string) { + public removeNode(id: string): void { const node = this._children.find(n => n.id === id); if (node) { const idx = this._children.indexOf(node); @@ -214,7 +214,7 @@ export class CompositeMenuNode implements MenuNode { } } - get sortString() { + get sortString(): string { return this.id; } @@ -256,7 +256,7 @@ export class ActionMenuNode implements MenuNode { return command && command.iconClass; } - get sortString() { + get sortString(): string { return this.action.order || this.label; } } diff --git a/packages/core/src/common/messaging/proxy-factory.spec.ts b/packages/core/src/common/messaging/proxy-factory.spec.ts index 924b797da2bb9..c9f9130e9d43c 100644 --- a/packages/core/src/common/messaging/proxy-factory.spec.ts +++ b/packages/core/src/common/messaging/proxy-factory.spec.ts @@ -16,7 +16,7 @@ import * as chai from 'chai'; import { ConsoleLogger } from '../../node/messaging/logger'; -import { JsonRpcProxyFactory } from './proxy-factory'; +import { JsonRpcProxyFactory, JsonRpcProxy } from './proxy-factory'; import { createMessageConnection } from 'vscode-jsonrpc/lib/main'; import * as stream from 'stream'; @@ -58,7 +58,7 @@ describe('Proxy-Factory', () => { it('Should correctly send notifications and requests.', done => { const it = getSetup(); it.clientProxy.notifyThat('hello'); - function check() { + function check(): void { if (it.client.notifications.length === 0) { console.log('waiting another 50 ms'); setTimeout(check, 50); @@ -92,7 +92,12 @@ describe('Proxy-Factory', () => { }); }); -function getSetup() { +function getSetup(): { + client: TestClient; + clientProxy: JsonRpcProxy; + server: TestServer; + serverProxy: JsonRpcProxy; +} { const client = new TestClient(); const server = new TestServer(); diff --git a/packages/core/src/common/messaging/proxy-factory.ts b/packages/core/src/common/messaging/proxy-factory.ts index 85d2dfaee26bb..27676d312b29e 100644 --- a/packages/core/src/common/messaging/proxy-factory.ts +++ b/packages/core/src/common/messaging/proxy-factory.ts @@ -129,7 +129,7 @@ export class JsonRpcProxyFactory implements ProxyHandler { * This connection will be used to send/receive JSON-RPC requests and * response. */ - listen(connection: MessageConnection) { + listen(connection: MessageConnection): void { if (this.target) { for (const prop in this.target) { if (typeof this.target[prop] === 'function') { diff --git a/packages/core/src/common/messaging/web-socket-channel.ts b/packages/core/src/common/messaging/web-socket-channel.ts index 8f4d014e06ea9..cc581db798922 100644 --- a/packages/core/src/common/messaging/web-socket-channel.ts +++ b/packages/core/src/common/messaging/web-socket-channel.ts @@ -42,7 +42,7 @@ export class WebSocketChannel implements IWebSocket { } } - handleMessage(message: WebSocketChannel.Message) { + handleMessage(message: WebSocketChannel.Message): void { if (message.kind === 'ready') { this.fireOpen(); } else if (message.kind === 'data') { diff --git a/packages/core/src/common/selection-service.spec.ts b/packages/core/src/common/selection-service.spec.ts index 66c227ba597a7..3c1114d16045d 100644 --- a/packages/core/src/common/selection-service.spec.ts +++ b/packages/core/src/common/selection-service.spec.ts @@ -38,6 +38,6 @@ describe('selection-service', () => { }); }); -function createSelectionService() { +function createSelectionService(): SelectionService { return new SelectionService(); } diff --git a/packages/core/src/common/test/mock-resource-provider.ts b/packages/core/src/common/test/mock-resource-provider.ts index 395d2fb9bf758..34c43f7be7872 100644 --- a/packages/core/src/common/test/mock-resource-provider.ts +++ b/packages/core/src/common/test/mock-resource-provider.ts @@ -24,9 +24,9 @@ export class MockResourceProvider { constructor() { } async get(uri: URI): Promise { - return await { + return { uri: new URI(''), - dispose() { }, + dispose(): void { }, readContents(options?: { encoding?: string }): Promise { return Promise.resolve(''); } }; } diff --git a/packages/core/src/common/uri-command-handler.ts b/packages/core/src/common/uri-command-handler.ts index ffbe4c09be09f..80c4623ac737d 100644 --- a/packages/core/src/common/uri-command-handler.ts +++ b/packages/core/src/common/uri-command-handler.ts @@ -113,7 +113,7 @@ export class UriAwareCommandHandler> implements Comman return false; } - protected isMulti() { + protected isMulti(): boolean | undefined { return this.options && !!this.options.multi; } diff --git a/packages/core/src/common/uri.ts b/packages/core/src/common/uri.ts index c69dd3de647a4..547785829675a 100644 --- a/packages/core/src/common/uri.ts +++ b/packages/core/src/common/uri.ts @@ -187,7 +187,7 @@ export default class URI { return this.codeUri.fragment; } - toString(skipEncoding?: boolean) { + toString(skipEncoding?: boolean): string { return this.codeUri.toString(skipEncoding); } diff --git a/packages/core/src/electron-browser/keyboard/electron-keyboard-layout-change-notifier.ts b/packages/core/src/electron-browser/keyboard/electron-keyboard-layout-change-notifier.ts index b27a0d9b090fc..1bce1911aa668 100644 --- a/packages/core/src/electron-browser/keyboard/electron-keyboard-layout-change-notifier.ts +++ b/packages/core/src/electron-browser/keyboard/electron-keyboard-layout-change-notifier.ts @@ -17,7 +17,7 @@ import { postConstruct, injectable } from 'inversify'; import { ipcRenderer } from 'electron'; import { KeyboardLayoutChangeNotifier, NativeKeyboardLayout } from '../../common/keyboard/keyboard-layout-provider'; -import { Emitter } from '../../common/event'; +import { Emitter, Event } from '../../common/event'; /** * Keyboard layout changes are detected by the native-keymap package. This must happen in the @@ -28,13 +28,14 @@ export class ElectronKeyboardLayoutChangeNotifier implements KeyboardLayoutChang protected readonly nativeLayoutChanged = new Emitter(); - get onDidChangeNativeLayout() { + get onDidChangeNativeLayout(): Event { return this.nativeLayoutChanged.event; } @postConstruct() protected initialize(): void { - ipcRenderer.on('keyboardLayoutChanged', (event: Event, newLayout: NativeKeyboardLayout) => this.nativeLayoutChanged.fire(newLayout)); + // tslint:disable-next-line:no-any + ipcRenderer.on('keyboardLayoutChanged', (event: Event, newLayout: NativeKeyboardLayout) => this.nativeLayoutChanged.fire(newLayout)); } } diff --git a/packages/core/src/electron-browser/menu/electron-menu-contribution.ts b/packages/core/src/electron-browser/menu/electron-menu-contribution.ts index 7e31e08c9b9ca..aa8142a05570e 100644 --- a/packages/core/src/electron-browser/menu/electron-menu-contribution.ts +++ b/packages/core/src/electron-browser/menu/electron-menu-contribution.ts @@ -175,7 +175,7 @@ export class ElectronMenuContribution implements FrontendApplicationContribution ); } - registerMenus(registry: MenuModelRegistry) { + registerMenus(registry: MenuModelRegistry): void { registry.registerMenuAction(ElectronMenus.HELP_TOGGLE, { commandId: ElectronCommands.TOGGLE_DEVELOPER_TOOLS.id }); diff --git a/packages/core/src/node/cli.spec.ts b/packages/core/src/node/cli.spec.ts index 6eebae572e3fc..9ea621fdcfed5 100644 --- a/packages/core/src/node/cli.spec.ts +++ b/packages/core/src/node/cli.spec.ts @@ -18,11 +18,12 @@ import * as yargs from 'yargs'; import * as chai from 'chai'; import { CliManager, CliContribution } from './cli'; import { Deferred } from '../common/promise-util'; +import { MaybePromise } from '../common/types'; class TestCliManager extends CliManager { constructor(...contribs: CliContribution[]) { super({ - getContributions() { return contribs; } + getContributions(): CliContribution[] { return contribs; } }); } } @@ -35,11 +36,11 @@ describe('CliManager', () => { it('Parses simple option', async () => { const value = new Deferred(); const mnr = new TestCliManager({ - configure(conf: yargs.Argv) { + configure(conf: yargs.Argv): void { conf.option('foo', { alias: 'f', description: 'Some foo.' }); conf.option('bar', { alias: 'b', description: 'Some bla.', default: 'my-default', type: 'string' }); }, - setArguments(args: yargs.Arguments) { + setArguments(args: yargs.Arguments): void { value.resolve(args['foo']); } }); @@ -50,11 +51,11 @@ describe('CliManager', () => { it('resolves with default', async () => { const value = new Deferred(); const mnr = new TestCliManager({ - configure(conf: yargs.Argv) { + configure(conf: yargs.Argv): void { conf.option('foo', { alias: 'f', description: 'Some foo.' }); conf.option('bar', { alias: 'b', description: 'Some bla.', default: 'my-default', type: 'string' }); }, - setArguments(args: yargs.Arguments) { + setArguments(args: yargs.Arguments): MaybePromise { value.resolve(args['bar']); } }); diff --git a/packages/core/src/node/console-logger-server.spec.ts b/packages/core/src/node/console-logger-server.spec.ts index 91f1cb87e2d93..53d9907731ffb 100644 --- a/packages/core/src/node/console-logger-server.spec.ts +++ b/packages/core/src/node/console-logger-server.spec.ts @@ -28,11 +28,11 @@ let logLevelCliContribution: MockLogLevelCliContribution; class MockLogLevelCliContribution extends LogLevelCliContribution { @postConstruct() - init() { + init(): void { this._logLevels['test-logger'] = LogLevel.DEBUG; } - changeLogLevel(newLevel: LogLevel) { + changeLogLevel(newLevel: LogLevel): void { this._logLevels['test-logger'] = newLevel; } } @@ -48,8 +48,8 @@ beforeEach(() => { server = container.get(ConsoleLoggerServer); }); -describe('ConsoleLoggerServer', function () { - it('should respect log level config', async function () { +describe('ConsoleLoggerServer', function (): void { + it('should respect log level config', async function (): Promise { expect(await server.getLogLevel('test-logger')).eq(LogLevel.DEBUG); await server.child('test-logger'); expect(await server.getLogLevel('test-logger')).eq(LogLevel.DEBUG); diff --git a/packages/core/src/node/console-logger-server.ts b/packages/core/src/node/console-logger-server.ts index fa1c3f21a98f3..f791489222379 100644 --- a/packages/core/src/node/console-logger-server.ts +++ b/packages/core/src/node/console-logger-server.ts @@ -31,7 +31,7 @@ export class ConsoleLoggerServer implements ILoggerServer { protected cli: LogLevelCliContribution; @postConstruct() - protected init() { + protected init(): void { for (const name of Object.keys(this.cli.logLevels)) { this.setLogLevel(name, this.cli.logLevels[name]); } @@ -66,7 +66,7 @@ export class ConsoleLoggerServer implements ILoggerServer { dispose(): void { } - setClient(client: ILoggerClient | undefined) { + setClient(client: ILoggerClient | undefined): void { this.client = client; } diff --git a/packages/core/src/node/file-uri.spec.ts b/packages/core/src/node/file-uri.spec.ts index 6e7cb66c8004b..97a94eab0d4d2 100644 --- a/packages/core/src/node/file-uri.spec.ts +++ b/packages/core/src/node/file-uri.spec.ts @@ -65,7 +65,7 @@ describe('file-uri', () => { expect(uri.toString(true)).to.be.equal('file:///c:/'); }); - it('from file:///c%3A', function () { + it('from file:///c%3A', function (): void { if (!isWindows) { this.skip(); return; diff --git a/packages/core/src/node/file-uri.ts b/packages/core/src/node/file-uri.ts index ffef213a7059d..3461d65af03c0 100644 --- a/packages/core/src/node/file-uri.ts +++ b/packages/core/src/node/file-uri.ts @@ -26,7 +26,7 @@ export namespace FileUri { * Creates a new file URI from the filesystem path argument. * @param fsPath the filesystem path. */ - export function create(fsPath_: string) { + export function create(fsPath_: string): URI { return new URI(Uri.file(fsPath_)); } diff --git a/packages/core/src/node/logger-backend-module.ts b/packages/core/src/node/logger-backend-module.ts index 640b1ccfe53c9..3f8501eba0622 100644 --- a/packages/core/src/node/logger-backend-module.ts +++ b/packages/core/src/node/logger-backend-module.ts @@ -55,7 +55,7 @@ export function bindLogger(bind: interfaces.Bind, props?: { export const loggerBackendModule = new ContainerModule(bind => { bind(BackendApplicationContribution).toDynamicValue(ctx => ({ - initialize() { + initialize(): void { setRootLogger(ctx.container.get(ILogger)); } })); diff --git a/packages/core/src/node/logger-cli-contribution.spec.ts b/packages/core/src/node/logger-cli-contribution.spec.ts index b700a0b11c5a9..c6c81f9c13738 100644 --- a/packages/core/src/node/logger-cli-contribution.spec.ts +++ b/packages/core/src/node/logger-cli-contribution.spec.ts @@ -196,7 +196,7 @@ describe('log-level-cli-contribution', () => { }); }); - it('should keep original levels when changing the log levels file with a broken one', async function () { + it('should keep original levels when changing the log levels file with a broken one', async function (): Promise { this.timeout(5000); const file = track.openSync(); diff --git a/packages/cpp/src/browser/cpp-build-configurations-ui.ts b/packages/cpp/src/browser/cpp-build-configurations-ui.ts index ff4dc05ec7a26..1dcc45116fb0e 100644 --- a/packages/cpp/src/browser/cpp-build-configurations-ui.ts +++ b/packages/cpp/src/browser/cpp-build-configurations-ui.ts @@ -116,7 +116,7 @@ export class CppBuildConfigurationChanger implements QuickOpenModel { acceptor(items); } - open() { + open(): void { const configs = this.cppBuildConfigurations.getValidConfigs(); this.quickOpenService.open(this, { placeholder: (configs.length) ? 'Choose a build configuration...' : 'No build configurations present', diff --git a/packages/cpp/src/browser/cpp-build-configurations.spec.ts b/packages/cpp/src/browser/cpp-build-configurations.spec.ts index 3ad288af72aba..dad3754709187 100644 --- a/packages/cpp/src/browser/cpp-build-configurations.spec.ts +++ b/packages/cpp/src/browser/cpp-build-configurations.spec.ts @@ -34,7 +34,7 @@ disableJSDOM(); let container: Container; -beforeEach(function () { +beforeEach(function (): void { const m = new ContainerModule(bind => { bind(CppBuildConfigurationManager).to(CppBuildConfigurationManagerImpl).inSingletonScope(); bind(StorageService).to(MockStorageService).inSingletonScope(); @@ -83,7 +83,7 @@ async function initializeTest(buildConfigurations: CppBuildConfiguration[] | und return configs; } -describe('build-configurations', function () { +describe('build-configurations', function (): void { before(() => { disableJSDOM = enableJSDOM(); }); @@ -92,7 +92,7 @@ describe('build-configurations', function () { disableJSDOM(); }); - it('should work with no preferences', async function () { + it('should work with no preferences', async function (): Promise { const cppBuildConfigurations = await initializeTest(undefined, undefined); const configs = cppBuildConfigurations.getConfigs(); @@ -102,7 +102,7 @@ describe('build-configurations', function () { expect(configs).lengthOf(0); }); - it('should work with an empty list of builds', async function () { + it('should work with an empty list of builds', async function (): Promise { const cppBuildConfigurations = await initializeTest([], undefined); const configs = cppBuildConfigurations.getConfigs(); @@ -112,7 +112,7 @@ describe('build-configurations', function () { expect(configs).lengthOf(0); }); - it('should work with a simple list of builds', async function () { + it('should work with a simple list of builds', async function (): Promise { const builds = [{ name: 'Release', directory: '/tmp/builds/release', @@ -130,7 +130,7 @@ describe('build-configurations', function () { expect(configs).to.have.deep.members(builds); }); - it('should work with a simple list of builds and an active config', async function () { + it('should work with a simple list of builds and an active config', async function (): Promise { const builds = [{ name: 'Release', directory: '/tmp/builds/release', @@ -148,7 +148,7 @@ describe('build-configurations', function () { expect(configs).to.have.deep.members(builds); }); - it("should ignore an active config that doesn't exist", async function () { + it("should ignore an active config that doesn't exist", async function (): Promise { const builds = [{ name: 'Release', directory: '/tmp/builds/release', diff --git a/packages/cpp/src/browser/cpp-build-configurations.ts b/packages/cpp/src/browser/cpp-build-configurations.ts index 90ee3fb226330..0f4784ec48414 100644 --- a/packages/cpp/src/browser/cpp-build-configurations.ts +++ b/packages/cpp/src/browser/cpp-build-configurations.ts @@ -130,7 +130,7 @@ export class CppBuildConfigurationManagerImpl implements CppBuildConfigurationMa public ready: Promise; @postConstruct() - async init() { + async init(): Promise { // Try to read the active build config from local storage. this.ready = new Promise(async resolve => { await this.cppPreferences.ready; diff --git a/packages/cpp/src/browser/cpp-language-client-contribution.ts b/packages/cpp/src/browser/cpp-language-client-contribution.ts index 5200adf995d33..27c1cf6b3c0d7 100644 --- a/packages/cpp/src/browser/cpp-language-client-contribution.ts +++ b/packages/cpp/src/browser/cpp-language-client-contribution.ts @@ -67,7 +67,7 @@ export class CppLanguageClientContribution extends BaseLanguageClientContributio } @postConstruct() - protected init() { + protected init(): void { this.cppBuildConfigurations.onActiveConfigChange(config => this.onActiveBuildConfigChanged(config)); this.cppPreferences.onPreferenceChanged(e => { if (this.running) { @@ -93,7 +93,7 @@ export class CppLanguageClientContribution extends BaseLanguageClientContributio return clangdParams; } - async onActiveBuildConfigChanged(config: CppBuildConfiguration | undefined) { + async onActiveBuildConfigChanged(config: CppBuildConfiguration | undefined): Promise { // Override the initializationOptions to put the new path to the build, // then restart clangd. if (this.running) { @@ -103,13 +103,13 @@ export class CppLanguageClientContribution extends BaseLanguageClientContributio } } - protected get documentSelector() { + protected get documentSelector(): string[] { // This is used (at least) to determine which files, when they are open, // trigger the launch of the C/C++ language server. return HEADER_AND_SOURCE_FILE_EXTENSIONS; } - protected get globPatterns() { + protected get globPatterns(): string[] { // This is used (at least) to determine which files we watch. Change // notifications are forwarded to the language server. return [ diff --git a/packages/cpp/src/browser/cpp-task-provider.spec.ts b/packages/cpp/src/browser/cpp-task-provider.spec.ts index d41da0d04689a..a0d707ef0da56 100644 --- a/packages/cpp/src/browser/cpp-task-provider.spec.ts +++ b/packages/cpp/src/browser/cpp-task-provider.spec.ts @@ -66,7 +66,7 @@ class MockCppBuildConfigurationManager implements CppBuildConfigurationManager { ready: Promise = Promise.resolve(); } -beforeEach(function () { +beforeEach(function (): void { const container: Container = new Container(); container.bind(CppTaskProvider).toSelf().inSingletonScope(); container.bind(CppBuildConfigurationManager).to(MockCppBuildConfigurationManager); @@ -87,8 +87,8 @@ beforeEach(function () { }); }); -describe('CppTaskProvider', function () { - it('provide a task for each build config with a build command', async function () { +describe('CppTaskProvider', function (): void { + it('provide a task for each build config with a build command', async function (): Promise { const tasks = await taskProvider.provideTasks(); expect(tasks).length(1); expect(tasks[0].config.name === 'Build 1'); diff --git a/packages/cpp/src/browser/cpp-task-provider.ts b/packages/cpp/src/browser/cpp-task-provider.ts index e6dbb715d57dd..7bc023c9fb0af 100644 --- a/packages/cpp/src/browser/cpp-task-provider.ts +++ b/packages/cpp/src/browser/cpp-task-provider.ts @@ -69,11 +69,11 @@ export class CppTaskProvider implements TaskContribution, TaskProvider, TaskReso }); } - registerProviders(registry: TaskProviderRegistry) { + registerProviders(registry: TaskProviderRegistry): void { registry.register(CPP_BUILD_TASK_SOURCE, this); } - registerResolvers(registry: TaskResolverRegistry) { + registerResolvers(registry: TaskResolverRegistry): void { registry.register(CPP_BUILD_TASK_TYPE_KEY, this); } diff --git a/packages/debug/src/browser/debug-session-connection.ts b/packages/debug/src/browser/debug-session-connection.ts index 001325011d556..dc66a6778ce1a 100644 --- a/packages/debug/src/browser/debug-session-connection.ts +++ b/packages/debug/src/browser/debug-session-connection.ts @@ -201,7 +201,7 @@ export class DebugSessionConnection implements Disposable { connection.send(messageStr); } - protected handleMessage(data: string) { + protected handleMessage(data: string): void { if (this.traceOutputChannel) { this.traceOutputChannel.appendLine(`${this.sessionId.substring(0, 8)} theia <- adapter: ${data}`); } diff --git a/packages/debug/src/browser/debug-session-manager.ts b/packages/debug/src/browser/debug-session-manager.ts index 0c874bed686cd..dd5a52ee319f1 100644 --- a/packages/debug/src/browser/debug-session-manager.ts +++ b/packages/debug/src/browser/debug-session-manager.ts @@ -300,7 +300,7 @@ export class DebugSessionManager { } } } - protected updateCurrentSession(session: DebugSession | undefined) { + protected updateCurrentSession(session: DebugSession | undefined): void { this.currentSession = session || this.sessions[0]; } diff --git a/packages/debug/src/browser/editor/debug-editor-model.ts b/packages/debug/src/browser/editor/debug-editor-model.ts index 7267b96197870..672ef4d500f14 100644 --- a/packages/debug/src/browser/editor/debug-editor-model.ts +++ b/packages/debug/src/browser/editor/debug-editor-model.ts @@ -247,13 +247,13 @@ export class DebugEditorModel implements Disposable { get breakpoint(): DebugBreakpoint | undefined { return this.getBreakpoint(); } - protected getBreakpoint(position: monaco.Position = this.position) { + protected getBreakpoint(position: monaco.Position = this.position): DebugBreakpoint | undefined { return this.sessions.getBreakpoint(this.uri, position.lineNumber); } toggleBreakpoint(): void { this.doToggleBreakpoint(); } - protected doToggleBreakpoint(position: monaco.Position = this.position) { + protected doToggleBreakpoint(position: monaco.Position = this.position): void { const breakpoint = this.getBreakpoint(position); if (breakpoint) { breakpoint.remove(); diff --git a/packages/debug/src/browser/editor/debug-editor-service.ts b/packages/debug/src/browser/editor/debug-editor-service.ts index 40adbeaa9ffe7..5275d3d9880dc 100644 --- a/packages/debug/src/browser/editor/debug-editor-service.ts +++ b/packages/debug/src/browser/editor/debug-editor-service.ts @@ -172,7 +172,7 @@ export class DebugEditorService { model.acceptBreakpoint(); } } - protected closeBreakpointIfAffected({ uri, removed }: BreakpointsChangeEvent) { + protected closeBreakpointIfAffected({ uri, removed }: BreakpointsChangeEvent): void { const model = this.models.get(uri.toString()); if (!model) { return; diff --git a/packages/debug/src/browser/preferences/launch-preferences.spec.ts b/packages/debug/src/browser/preferences/launch-preferences.spec.ts index 8ff4a3757b36e..98d54bb76fb43 100644 --- a/packages/debug/src/browser/preferences/launch-preferences.spec.ts +++ b/packages/debug/src/browser/preferences/launch-preferences.spec.ts @@ -416,7 +416,7 @@ describe('Launch Preferences', () => { let preferences: PreferenceService; const toTearDown = new DisposableCollection(); - beforeEach(async function () { + beforeEach(async function (): Promise { toTearDown.push(Disposable.create(enableJSDOM())); FrontendApplicationConfigProvider.set({ 'applicationName': 'test', diff --git a/packages/debug/src/node/vscode/vscode-debug-adapter-contribution.ts b/packages/debug/src/node/vscode/vscode-debug-adapter-contribution.ts index 5cd5ff7e8d07b..22cff4072535b 100644 --- a/packages/debug/src/node/vscode/vscode-debug-adapter-contribution.ts +++ b/packages/debug/src/node/vscode/vscode-debug-adapter-contribution.ts @@ -23,7 +23,7 @@ import { deepClone } from '@theia/core/lib/common/objects'; import { injectable, unmanaged } from 'inversify'; namespace nls { - export function localize(key: string, _default: string) { + export function localize(key: string, _default: string): string { return _default; } } diff --git a/packages/editor/src/browser/decorations/editor-decorator.ts b/packages/editor/src/browser/decorations/editor-decorator.ts index 634eae54d9546..42e92c5094ff8 100644 --- a/packages/editor/src/browser/decorations/editor-decorator.ts +++ b/packages/editor/src/browser/decorations/editor-decorator.ts @@ -23,7 +23,7 @@ export abstract class EditorDecorator { protected readonly appliedDecorations = new Map(); - protected setDecorations(editor: TextEditor, newDecorations: EditorDecoration[]) { + protected setDecorations(editor: TextEditor, newDecorations: EditorDecoration[]): void { const uri = editor.uri.toString(); const oldDecorations = this.appliedDecorations.get(uri) || []; if (oldDecorations.length === 0 && newDecorations.length === 0) { diff --git a/packages/editor/src/browser/editor-menu.ts b/packages/editor/src/browser/editor-menu.ts index a35197af64720..c2c86c3559474 100644 --- a/packages/editor/src/browser/editor-menu.ts +++ b/packages/editor/src/browser/editor-menu.ts @@ -50,7 +50,7 @@ export namespace EditorMainMenu { @injectable() export class EditorMenuContribution implements MenuContribution { - registerMenus(registry: MenuModelRegistry) { + registerMenus(registry: MenuModelRegistry): void { registry.registerMenuAction(EditorContextMenu.UNDO_REDO, { commandId: CommonCommands.UNDO.id }); diff --git a/packages/editor/src/browser/semantic-highlight/semantic-highlighting-service.spec.ts b/packages/editor/src/browser/semantic-highlight/semantic-highlighting-service.spec.ts index a892206e2e79b..020984182c810 100644 --- a/packages/editor/src/browser/semantic-highlight/semantic-highlighting-service.spec.ts +++ b/packages/editor/src/browser/semantic-highlight/semantic-highlighting-service.spec.ts @@ -36,7 +36,7 @@ describe('semantic-highlighting-service', () => { expect(actual).to.be.deep.equal(expected); }); - it('should fill with zeros when right shift for the decode phase', function () { + it('should fill with zeros when right shift for the decode phase', function (): void { this.timeout(10_000); const input: number[] = []; for (let i = 0; i < 65_536; i++) { diff --git a/packages/editorconfig/src/browser/editorconfig-document-manager.spec.ts b/packages/editorconfig/src/browser/editorconfig-document-manager.spec.ts index 30ecaed523406..12ae0fe27e53e 100644 --- a/packages/editorconfig/src/browser/editorconfig-document-manager.spec.ts +++ b/packages/editorconfig/src/browser/editorconfig-document-manager.spec.ts @@ -28,7 +28,7 @@ import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor'; disableJSDOM(); -describe('Editorconfig document manager', function () { +describe('Editorconfig document manager', function (): void { it('IsSet should return true', () => { const documentManager = new EditorconfigDocumentManager(); diff --git a/packages/editorconfig/src/browser/editorconfig-document-manager.ts b/packages/editorconfig/src/browser/editorconfig-document-manager.ts index 53d790a40ee4c..0019a1a6e134c 100644 --- a/packages/editorconfig/src/browser/editorconfig-document-manager.ts +++ b/packages/editorconfig/src/browser/editorconfig-document-manager.ts @@ -58,7 +58,7 @@ export class EditorconfigDocumentManager { * * @param editorWidget editor widget */ - protected addOnSaveHandler(editorWidget: EditorWidget) { + protected addOnSaveHandler(editorWidget: EditorWidget): void { const monacoEditor = MonacoEditor.get(editorWidget); if (monacoEditor) { monacoEditor.document.onWillSaveModel(event => { @@ -93,7 +93,7 @@ export class EditorconfigDocumentManager { * * @param editor editor */ - protected refreshProperties(editor: TextEditor) { + protected refreshProperties(editor: TextEditor): void { if (editor instanceof MonacoEditor) { const uri = editor.uri.toString(); this.editorconfigServer.getConfig(uri).then(properties => { diff --git a/packages/extension-manager/src/browser/extension-contribution.ts b/packages/extension-manager/src/browser/extension-contribution.ts index e5f70f62a0184..d50a88df7267b 100644 --- a/packages/extension-manager/src/browser/extension-contribution.ts +++ b/packages/extension-manager/src/browser/extension-contribution.ts @@ -42,7 +42,7 @@ export class ExtensionContribution extends AbstractViewContribution { if (reverting) { this.messageService.error('Failed to install extensions. Reverting...'); diff --git a/packages/extension-manager/src/browser/extension-widget.tsx b/packages/extension-manager/src/browser/extension-widget.tsx index a02e2faf3fd14..c0d4182eb2458 100644 --- a/packages/extension-manager/src/browser/extension-widget.tsx +++ b/packages/extension-manager/src/browser/extension-widget.tsx @@ -50,7 +50,7 @@ export class ExtensionWidget extends ReactWidget { this.toDispose.push(extensionManager.onDidChange(() => this.update())); } - protected onActivateRequest(msg: Message) { + protected onActivateRequest(msg: Message): void { super.onActivateRequest(msg); this.fetchExtensions(); const searchField = this.findSearchField(); @@ -119,7 +119,7 @@ export class ExtensionWidget extends ReactWidget { protected extensionClick = (extension: Extension) => open(this.openerService, ExtensionUri.toUri(extension.name)); - private renderExtension(extension: Extension) { + private renderExtension(extension: Extension): JSX.Element { const extensionButtonContainer = !extension.dependent ?
{this.createButton(extension)}
: 'installed via ' + extension.dependent; diff --git a/packages/extension-manager/src/common/extension-manager.ts b/packages/extension-manager/src/common/extension-manager.ts index 958697258b020..45512f4ee7ac1 100644 --- a/packages/extension-manager/src/common/extension-manager.ts +++ b/packages/extension-manager/src/common/extension-manager.ts @@ -129,7 +129,7 @@ export class ExtensionManager implements Disposable { }); } - dispose() { + dispose(): void { this.toDispose.dispose(); } diff --git a/packages/extension-manager/src/node/application-project.spec.ts b/packages/extension-manager/src/node/application-project.spec.ts index b21d6b6369fc9..d4cb1e98428ce 100644 --- a/packages/extension-manager/src/node/application-project.spec.ts +++ b/packages/extension-manager/src/node/application-project.spec.ts @@ -53,9 +53,9 @@ export async function assertInstallation(expectation: { assert.equal(false, result.failed, 'the installation is failed'); } -describe('application-project', function () { +describe('application-project', function (): void { - beforeEach(function () { + beforeEach(function (): void { this.timeout(50000); const dir = path.resolve(__dirname, '..', '..', 'application-project-test-temp'); @@ -69,13 +69,13 @@ describe('application-project', function () { }).get(ApplicationProject); }); - afterEach(function () { + afterEach(function (): void { this.timeout(50000); appProject.dispose(); fs.removeSync(appProjectPath); }); - it.skip('install', async function () { + it.skip('install', async function (): Promise { this.timeout(1800000); await fs.writeJSON(path.resolve(appProjectPath, 'package.json'), { diff --git a/packages/extension-manager/src/node/node-extension-server.slow-spec.ts b/packages/extension-manager/src/node/node-extension-server.slow-spec.ts index 815d85c01257c..047c1d93cd8bb 100644 --- a/packages/extension-manager/src/node/node-extension-server.slow-spec.ts +++ b/packages/extension-manager/src/node/node-extension-server.slow-spec.ts @@ -42,9 +42,9 @@ export function waitForDidChange(): Promise { const dir = path.resolve(__dirname, '..', '..', 'node-extension-server-test-temp'); fs.ensureDirSync(dir); -describe('node-extension-server', function () { +describe('node-extension-server', function (): void { - beforeEach(function () { + beforeEach(function (): void { this.timeout(50000); appProjectPath = temp.mkdirSync({ dir }); fs.writeJsonSync(path.resolve(appProjectPath, 'package.json'), { @@ -64,14 +64,14 @@ describe('node-extension-server', function () { appProject = container.get(ApplicationProject); }); - afterEach(function () { + afterEach(function (): void { this.timeout(50000); server.dispose(); appProject.dispose(); fs.removeSync(appProjectPath); }); - it.skip('search', function () { + it.skip('search', async function (): Promise { this.timeout(30000); return server.search({ @@ -82,7 +82,7 @@ describe('node-extension-server', function () { }); }); - it.skip('installed', function () { + it.skip('installed', async function (): Promise { this.timeout(10000); return server.installed().then(extensions => { @@ -93,7 +93,7 @@ describe('node-extension-server', function () { }); }); - it.skip('install', async function () { + it.skip('install', async function (): Promise { this.timeout(10000); const before = await server.installed(); @@ -109,7 +109,7 @@ describe('node-extension-server', function () { }); }); - it.skip('uninstall', async function () { + it.skip('uninstall', async function (): Promise { this.timeout(10000); const before = await server.installed(); @@ -125,7 +125,7 @@ describe('node-extension-server', function () { }); }); - it.skip('outdated', function () { + it.skip('outdated', async function (): Promise { this.timeout(10000); return server.outdated().then(extensions => { @@ -134,7 +134,7 @@ describe('node-extension-server', function () { }); }); - it.skip('update', async function () { + it.skip('update', async function (): Promise { this.timeout(10000); const before = await server.outdated(); @@ -150,7 +150,7 @@ describe('node-extension-server', function () { }); }); - it.skip('list', function () { + it.skip('list', async function (): Promise { this.timeout(10000); return server.list().then(extensions => { @@ -177,7 +177,7 @@ describe('node-extension-server', function () { }); }); - it.skip('list with search', function () { + it.skip('list with search', async function (): Promise { this.timeout(50000); return server.list({ diff --git a/packages/file-search/src/browser/quick-file-open.ts b/packages/file-search/src/browser/quick-file-open.ts index 92a30a8d30649..92f2b4fc1f8f7 100644 --- a/packages/file-search/src/browser/quick-file-open.ts +++ b/packages/file-search/src/browser/quick-file-open.ts @@ -213,7 +213,7 @@ export class QuickFileOpenService implements QuickOpenModel, QuickOpenHandler { } } - protected getRunFunction(uri: URI) { + protected getRunFunction(uri: URI): (mode: QuickOpenMode) => boolean { return (mode: QuickOpenMode) => { if (mode !== QuickOpenMode.OPEN) { return false; @@ -241,7 +241,7 @@ export class QuickFileOpenService implements QuickOpenModel, QuickOpenHandler { * @param str the raw string value. * @returns the normalized string value. */ - function normalize(str: string) { + function normalize(str: string): string { return str.trim().toLowerCase(); } @@ -316,7 +316,7 @@ export class QuickFileOpenService implements QuickOpenModel, QuickOpenHandler { .catch(error => this.messageService.error(error)); } - private async toItem(uriOrString: URI | string, group?: QuickOpenGroupItemOptions) { + private async toItem(uriOrString: URI | string, group?: QuickOpenGroupItemOptions): Promise> { const uri = uriOrString instanceof URI ? uriOrString : new URI(uriOrString); let description = this.labelProvider.getLongName(uri.parent); if (this.workspaceService.isMultiRootWorkspaceOpened) { diff --git a/packages/file-search/src/node/file-search-service-impl.spec.ts b/packages/file-search/src/node/file-search-service-impl.spec.ts index 70cfb4bc86cda..cdaddf1a62e2f 100644 --- a/packages/file-search/src/node/file-search-service-impl.spec.ts +++ b/packages/file-search/src/node/file-search-service-impl.spec.ts @@ -36,7 +36,7 @@ testContainer.load(new ContainerModule(bind => { bind(FileSearchServiceImpl).toSelf().inSingletonScope(); })); -describe('search-service', function () { +describe('search-service', function (): void { this.timeout(10000); diff --git a/packages/filesystem/src/browser/filesystem-frontend-contribution.ts b/packages/filesystem/src/browser/filesystem-frontend-contribution.ts index aa1d1c12e011e..90fb15f9785fd 100644 --- a/packages/filesystem/src/browser/filesystem-frontend-contribution.ts +++ b/packages/filesystem/src/browser/filesystem-frontend-contribution.ts @@ -185,7 +185,7 @@ export class FileSystemFrontendContribution implements FrontendApplicationContri protected updateWidget(uri: URI, widget: NavigatableWidget, event: FileChangeEvent, { dirty, toClose }: { dirty: Set; toClose: Map - }) { + }): void { const label = widget.title.label; const deleted = label.endsWith(this.deletedSuffix); if (FileChangeEvent.isDeleted(event, uri)) { diff --git a/packages/filesystem/src/browser/location/location-renderer.tsx b/packages/filesystem/src/browser/location/location-renderer.tsx index d808a83e6f817..fac979e0ae92c 100644 --- a/packages/filesystem/src/browser/location/location-renderer.tsx +++ b/packages/filesystem/src/browser/location/location-renderer.tsx @@ -81,7 +81,7 @@ export class LocationListRenderer extends ReactRenderer { /** * Asynchronously loads the drives (if not yet available) and triggers a UI update on success with the new values. */ - protected doLoadDrives() { + protected doLoadDrives(): void { if (!this._drives) { this.service.drives().then(drives => { // If the `drives` are empty, something already went wrong. diff --git a/packages/filesystem/src/common/test/mock-filesystem-watcher-server.ts b/packages/filesystem/src/common/test/mock-filesystem-watcher-server.ts index 9ae64370e315e..8dcbbd582385a 100644 --- a/packages/filesystem/src/common/test/mock-filesystem-watcher-server.ts +++ b/packages/filesystem/src/common/test/mock-filesystem-watcher-server.ts @@ -20,7 +20,7 @@ import { FileSystemWatcherServer, FileSystemWatcherClient, WatchOptions } from ' @injectable() export class MockFilesystemWatcherServer implements FileSystemWatcherServer { - dispose() { } + dispose(): void { } watchFileChanges(uri: string, options?: WatchOptions): Promise { return Promise.resolve(0); @@ -30,6 +30,6 @@ export class MockFilesystemWatcherServer implements FileSystemWatcherServer { return Promise.resolve(); } - setClient(client: FileSystemWatcherClient) { } + setClient(client: FileSystemWatcherClient): void { } } diff --git a/packages/filesystem/src/common/test/mock-filesystem.ts b/packages/filesystem/src/common/test/mock-filesystem.ts index 72518c13ec711..d055f763511fe 100644 --- a/packages/filesystem/src/common/test/mock-filesystem.ts +++ b/packages/filesystem/src/common/test/mock-filesystem.ts @@ -26,7 +26,7 @@ const mockFileStat = { @injectable() export class MockFilesystem implements FileSystem { - dispose() { } + dispose(): void { } getFileStat(uri: string): Promise { return Promise.resolve(mockFileStat); @@ -89,7 +89,7 @@ export class MockFilesystem implements FileSystem { return true; } - setClient(client: FileSystemClient) { + setClient(client: FileSystemClient): void { } diff --git a/packages/filesystem/src/node/download/directory-archiver.spec.ts b/packages/filesystem/src/node/download/directory-archiver.spec.ts index a8377f7235bc2..4370479a29b37 100644 --- a/packages/filesystem/src/node/download/directory-archiver.spec.ts +++ b/packages/filesystem/src/node/download/directory-archiver.spec.ts @@ -33,7 +33,7 @@ describe('directory-archiver', () => { track.cleanupSync(); }); - it('should archive a directory', async function () { + it('should archive a directory', async function (): Promise { this.timeout(20_000); const fromPath = track.mkdirSync('from'); fs.writeFileSync(path.join(fromPath, 'A.txt'), 'A'); diff --git a/packages/filesystem/src/node/node-filesystem.spec.ts b/packages/filesystem/src/node/node-filesystem.spec.ts index 3edfacbe17fb7..6312e4085766a 100644 --- a/packages/filesystem/src/node/node-filesystem.spec.ts +++ b/packages/filesystem/src/node/node-filesystem.spec.ts @@ -30,7 +30,7 @@ import { expectThrowsAsync } from '@theia/core/lib/common/test/expect'; const expect = chai.expect; const track = temp.track(); -describe('NodeFileSystem', function () { +describe('NodeFileSystem', function (): void { let root: URI; let fileSystem: FileSystem; @@ -366,7 +366,7 @@ describe('NodeFileSystem', function () { await expectThrowsAsync(fileSystem.move(sourceUri.toString(), targetUri.toString(), { overwrite: true }), Error); }); - it('Moving a non-empty directory to an empty directory. Source folder and its content should be moved to the target location.', async function () { + it('Moving a non-empty directory to an empty directory. Source folder and its content should be moved to the target location.', async function (): Promise { if (isWindows) { // https://github.com/theia-ide/theia/issues/2088 this.skip(); @@ -778,7 +778,7 @@ describe('NodeFileSystem', function () { describe('#16 drives', async () => { - it('should list URIs of the drives', async function () { + it('should list URIs of the drives', async function (): Promise { this.timeout(10_000); const drives = await createFileSystem().getDrives(); expect(drives).to.be.not.empty; @@ -788,11 +788,11 @@ describe('NodeFileSystem', function () { describe('#17 fsPath', async () => { - it('should return undefined', async function () { + it('should return undefined', async function (): Promise { expect(await createFileSystem().getFsPath('http://www.theia-ide.org')).to.be.undefined; }); - it('should return a platform specific path', async function () { + it('should return a platform specific path', async function (): Promise { if (isWindows) { expect(await createFileSystem().getFsPath('file:///C:/user/theia')).to.be.equal('c:\\user\\theia'); expect(await createFileSystem().getFsPath('file:///C%3A/user/theia')).to.be.equal('c:\\user\\theia'); @@ -806,7 +806,7 @@ describe('NodeFileSystem', function () { return new FileSystemNode(); } - function sleep(time: number) { + function sleep(time: number): Promise { return new Promise(resolve => setTimeout(resolve, time)); } diff --git a/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.spec.ts b/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.spec.ts index 7073360076e22..d00ac9fb68ac5 100644 --- a/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.spec.ts +++ b/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.spec.ts @@ -27,7 +27,7 @@ import { DidFilesChangedParams } from '../../common/filesystem-watcher-protocol' const expect = chai.expect; const track = temp.track(); -describe('nsfw-filesystem-watcher', function () { +describe('nsfw-filesystem-watcher', function (): void { let root: URI; let watcherServer: NsfwFileSystemWatcherServer; @@ -47,7 +47,7 @@ describe('nsfw-filesystem-watcher', function () { watcherServer.dispose(); }); - it('Should receive file changes events from in the workspace by default.', async function () { + it('Should receive file changes events from in the workspace by default.', async function (): Promise { if (process.platform === 'win32') { this.skip(); return; @@ -55,7 +55,7 @@ describe('nsfw-filesystem-watcher', function () { const actualUris = new Set(); const watcherClient = { - onDidFilesChanged(event: DidFilesChangedParams) { + onDidFilesChanged(event: DidFilesChangedParams): void { event.changes.forEach(c => actualUris.add(c.uri.toString())); } }; @@ -82,7 +82,7 @@ describe('nsfw-filesystem-watcher', function () { assert.deepEqual(expectedUris, [...actualUris]); }); - it('Should not receive file changes events from in the workspace by default if unwatched', async function () { + it('Should not receive file changes events from in the workspace by default if unwatched', async function (): Promise { if (process.platform === 'win32') { this.skip(); return; @@ -90,7 +90,7 @@ describe('nsfw-filesystem-watcher', function () { const actualUris = new Set(); const watcherClient = { - onDidFilesChanged(event: DidFilesChangedParams) { + onDidFilesChanged(event: DidFilesChangedParams): void { event.changes.forEach(c => actualUris.add(c.uri.toString())); } }; @@ -114,13 +114,13 @@ describe('nsfw-filesystem-watcher', function () { assert.deepEqual(0, actualUris.size); }); - function createNsfwFileSystemWatcherServer() { + function createNsfwFileSystemWatcherServer(): NsfwFileSystemWatcherServer { return new NsfwFileSystemWatcherServer({ verbose: true }); } - function sleep(time: number) { + function sleep(time: number): Promise { return new Promise(resolve => setTimeout(resolve, time)); } diff --git a/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.ts b/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.ts index 5d1b839d1b215..2b290a2a14f4e 100644 --- a/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.ts +++ b/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.ts @@ -165,7 +165,7 @@ export class NsfwFileSystemWatcherServer implements FileSystemWatcherServer { return Promise.resolve(); } - setClient(client: FileSystemWatcherClient | undefined) { + setClient(client: FileSystemWatcherClient | undefined): void { if (client && this.toDispose.disposed) { return; } diff --git a/packages/git/src/browser/blame/blame-contribution.ts b/packages/git/src/browser/blame/blame-contribution.ts index 67c24c7248c14..07806ca6ac83f 100644 --- a/packages/git/src/browser/blame/blame-contribution.ts +++ b/packages/git/src/browser/blame/blame-contribution.ts @@ -104,7 +104,7 @@ export class BlameContribution implements CommandContribution, KeybindingContrib protected appliedDecorations = new Map(); - protected async showBlame(editorWidget: EditorWidget) { + protected async showBlame(editorWidget: EditorWidget): Promise { const uri = editorWidget.editor.uri.toString(); if (this.appliedDecorations.get(uri)) { return; @@ -127,7 +127,7 @@ export class BlameContribution implements CommandContribution, KeybindingContrib } } - protected clearBlame(uri: string | URI) { + protected clearBlame(uri: string | URI): void { const decorations = this.appliedDecorations.get(uri.toString()); if (decorations) { this.appliedDecorations.delete(uri.toString()); diff --git a/packages/git/src/browser/blame/blame-module.ts b/packages/git/src/browser/blame/blame-module.ts index 5c1336ffd3a69..acfe022445dd0 100644 --- a/packages/git/src/browser/blame/blame-module.ts +++ b/packages/git/src/browser/blame/blame-module.ts @@ -21,7 +21,7 @@ import { BlameContribution, BlameAnnotationsKeybindingContext } from './blame-co import { BlameDecorator } from './blame-decorator'; import { BlameManager } from './blame-manager'; -export function bindBlame(bind: interfaces.Bind) { +export function bindBlame(bind: interfaces.Bind): void { bind(BlameContribution).toSelf().inSingletonScope(); bind(BlameManager).toSelf().inSingletonScope(); bind(BlameDecorator).toSelf().inSingletonScope(); diff --git a/packages/git/src/browser/diff/git-diff-frontend-module.ts b/packages/git/src/browser/diff/git-diff-frontend-module.ts index 249d4def35d44..9ce1e5fab418d 100644 --- a/packages/git/src/browser/diff/git-diff-frontend-module.ts +++ b/packages/git/src/browser/diff/git-diff-frontend-module.ts @@ -21,7 +21,7 @@ import { GitDiffWidget, GIT_DIFF } from './git-diff-widget'; import '../../../src/browser/style/diff.css'; -export function bindGitDiffModule(bind: interfaces.Bind) { +export function bindGitDiffModule(bind: interfaces.Bind): void { bind(GitDiffWidget).toSelf(); bind(WidgetFactory).toDynamicValue(ctx => ({ diff --git a/packages/git/src/browser/diff/git-diff-widget.tsx b/packages/git/src/browser/diff/git-diff-widget.tsx index 85176f47b3889..12a2d8c1a0af3 100644 --- a/packages/git/src/browser/diff/git-diff-widget.tsx +++ b/packages/git/src/browser/diff/git-diff-widget.tsx @@ -59,7 +59,7 @@ export class GitDiffWidget extends GitNavigableListWidget imp } @postConstruct() - protected init() { + protected init(): void { this.toDispose.push(this.gitWatcher.onGitEvent(async gitEvent => { if (this.options) { this.setContent(this.options); @@ -67,15 +67,15 @@ export class GitDiffWidget extends GitNavigableListWidget imp })); } - protected get toRevision() { + protected get toRevision(): string | undefined { return this.options.range && this.options.range.toRevision; } - protected get fromRevision() { + protected get fromRevision(): string | number | undefined { return this.options.range && this.options.range.fromRevision; } - async setContent(options: Git.Options.Diff) { + async setContent(options: Git.Options.Diff): Promise { this.options = options; const repository = this.repositoryProvider.findRepositoryOrSelected(options); if (repository) { @@ -191,7 +191,7 @@ export class GitDiffWidget extends GitNavigableListWidget imp this.renderNavigationRight() ); } - protected doRenderToolbar(...children: React.ReactNode[]) { + protected doRenderToolbar(...children: React.ReactNode[]): React.ReactNode { return this.renderHeaderRow({ classNames: ['space-between'], name: 'Files changed', @@ -200,7 +200,7 @@ export class GitDiffWidget extends GitNavigableListWidget imp } protected readonly showPreviousChange = () => this.doShowPreviousChange(); - protected doShowPreviousChange() { + protected doShowPreviousChange(): void { this.navigateLeft(); } @@ -209,7 +209,7 @@ export class GitDiffWidget extends GitNavigableListWidget imp } protected readonly showNextChange = () => this.doShowNextChange(); - protected doShowNextChange() { + protected doShowNextChange(): void { this.navigateRight(); } @@ -234,7 +234,7 @@ export class GitDiffWidget extends GitNavigableListWidget imp } protected addGitDiffListKeyListeners = (id: string) => this.doAddGitDiffListKeyListeners(id); - protected doAddGitDiffListKeyListeners(id: string) { + protected doAddGitDiffListKeyListeners(id: string): void { const container = document.getElementById(id); if (container) { this.addGitListNavigationKeyListeners(container); @@ -313,7 +313,7 @@ export class GitDiffWidget extends GitNavigableListWidget imp } } - protected selectNextNode() { + protected selectNextNode(): void { const idx = this.indexOfSelected; if (idx >= 0 && idx < this.gitNodes.length - 1) { this.selectNode(this.gitNodes[idx + 1]); @@ -322,7 +322,7 @@ export class GitDiffWidget extends GitNavigableListWidget imp } } - protected selectPreviousNode() { + protected selectPreviousNode(): void { const idx = this.indexOfSelected; if (idx > 0) { this.selectNode(this.gitNodes[idx - 1]); @@ -404,16 +404,16 @@ export namespace GitDiffListContainer { export class GitDiffListContainer extends React.Component { protected listContainer?: HTMLDivElement; - render() { + render(): JSX.Element { const { id, files } = this.props; return
this.listContainer = ref || undefined} className='listContainer filesChanged' id={id} tabIndex={0}>{...files}
; } - componentDidMount() { + componentDidMount(): void { this.props.addDiffListKeyListeners(this.props.id); } - focus() { + focus(): void { if (this.listContainer) { this.listContainer.focus(); } diff --git a/packages/git/src/browser/dirty-diff/dirty-diff-manager.ts b/packages/git/src/browser/dirty-diff/dirty-diff-manager.ts index f186e10bcee09..ef92b7bbe075b 100644 --- a/packages/git/src/browser/dirty-diff/dirty-diff-manager.ts +++ b/packages/git/src/browser/dirty-diff/dirty-diff-manager.ts @@ -54,7 +54,7 @@ export class DirtyDiffManager { protected readonly preferences: GitPreferences; @postConstruct() - protected async initialize() { + protected async initialize(): Promise { this.editorManager.onCreated(async e => this.handleEditorCreated(e)); this.repositoryTracker.onGitEvent(throttle(async (event: GitStatusChangeEvent | undefined) => this.handleGitStatusUpdate(event && event.source, event && event.status), 500)); diff --git a/packages/git/src/browser/dirty-diff/dirty-diff-module.ts b/packages/git/src/browser/dirty-diff/dirty-diff-module.ts index 66645a7c6cb99..75b5765800544 100644 --- a/packages/git/src/browser/dirty-diff/dirty-diff-module.ts +++ b/packages/git/src/browser/dirty-diff/dirty-diff-module.ts @@ -21,7 +21,7 @@ import { DirtyDiffManager } from './dirty-diff-manager'; import '../../../src/browser/style/dirty-diff.css'; -export function bindDirtyDiff(bind: interfaces.Bind) { +export function bindDirtyDiff(bind: interfaces.Bind): void { bind(DirtyDiffManager).toSelf().inSingletonScope(); bind(DirtyDiffContribution).toSelf().inSingletonScope(); bind(FrontendApplicationContribution).toService(DirtyDiffContribution); diff --git a/packages/git/src/browser/git-navigable-list-widget.tsx b/packages/git/src/browser/git-navigable-list-widget.tsx index d35e5e5566502..9838920346bad 100644 --- a/packages/git/src/browser/git-navigable-list-widget.tsx +++ b/packages/git/src/browser/git-navigable-list-widget.tsx @@ -109,7 +109,7 @@ export abstract class GitNavigableListWidget e ; } - protected addGitListNavigationKeyListeners(container: HTMLElement) { + protected addGitListNavigationKeyListeners(container: HTMLElement): void { this.addKeyListener(container, Key.ARROW_LEFT, () => this.navigateLeft()); this.addKeyListener(container, Key.ARROW_RIGHT, () => this.navigateRight()); this.addKeyListener(container, Key.ARROW_UP, () => this.navigateUp()); @@ -141,7 +141,7 @@ export abstract class GitNavigableListWidget e return this.gitNodes ? this.gitNodes.find(c => c.selected || false) : undefined; } - protected selectNode(node: T) { + protected selectNode(node: T): void { const n = this.getSelected(); if (n) { n.selected = false; @@ -150,7 +150,7 @@ export abstract class GitNavigableListWidget e this.update(); } - protected selectNextNode() { + protected selectNextNode(): void { const idx = this.indexOfSelected; if (idx >= 0 && idx < this.gitNodes.length - 1) { this.selectNode(this.gitNodes[idx + 1]); @@ -159,7 +159,7 @@ export abstract class GitNavigableListWidget e } } - protected selectPreviousNode() { + protected selectPreviousNode(): void { const idx = this.indexOfSelected; if (idx > 0) { this.selectNode(this.gitNodes[idx - 1]); diff --git a/packages/git/src/browser/git-quick-open-service.ts b/packages/git/src/browser/git-quick-open-service.ts index 31e71a257b258..e2ff37a2a1304 100644 --- a/packages/git/src/browser/git-quick-open-service.ts +++ b/packages/git/src/browser/git-quick-open-service.ts @@ -355,7 +355,7 @@ export class GitQuickOpenService { this.quickOpenService.open(quickOpenModel, this.getOptions('Stash message', false)); } - protected async doStashAction(action: 'pop' | 'apply' | 'drop', text: string, getMessage?: () => Promise) { + protected async doStashAction(action: 'pop' | 'apply' | 'drop', text: string, getMessage?: () => Promise): Promise { const repo = this.repositoryProvider.selectedRepository; if (repo) { const list = await this.git.stash(repo, { action: 'list' }); diff --git a/packages/git/src/browser/git-scm-provider.ts b/packages/git/src/browser/git-scm-provider.ts index f2519e7db71ea..4b5f005d9e31f 100644 --- a/packages/git/src/browser/git-scm-provider.ts +++ b/packages/git/src/browser/git-scm-provider.ts @@ -423,7 +423,13 @@ export class GitAmendSupport implements ScmAmendSupport { } } - private createScmCommit(gitCommit: CommitWithChanges) { + private createScmCommit(gitCommit: CommitWithChanges): { + id: string; + summary: string; + authorName: string; + authorEmail: string; + authorDateRelative: string; + } { return { id: gitCommit.sha, summary: gitCommit.summary, diff --git a/packages/git/src/browser/git-uri-label-contribution.ts b/packages/git/src/browser/git-uri-label-contribution.ts index 81c5c196a3db7..875f31d3b20aa 100644 --- a/packages/git/src/browser/git-uri-label-contribution.ts +++ b/packages/git/src/browser/git-uri-label-contribution.ts @@ -45,11 +45,11 @@ export class GitUriLabelProviderContribution implements LabelProviderContributio return this.labelProvider.getIcon(this.toFileUri(uri)); } - protected toFileUri(uri: URI) { + protected toFileUri(uri: URI): URI { return uri.withScheme('file'); } - protected getTagSuffix(uri: URI) { + protected getTagSuffix(uri: URI): string { if (uri.query) { return ` (${uri.query})`; } else { diff --git a/packages/git/src/browser/history/git-history-contribution.ts b/packages/git/src/browser/history/git-history-contribution.ts index 0df1d59da35cd..4a23bfa852f17 100644 --- a/packages/git/src/browser/history/git-history-contribution.ts +++ b/packages/git/src/browser/history/git-history-contribution.ts @@ -69,7 +69,7 @@ export class GitHistoryContribution extends AbstractViewContribution { this.refreshWidget(repository ? repository.localUri : undefined); } @@ -115,7 +115,7 @@ export class GitHistoryContribution extends AbstractViewContribution { const widget = this.tryGetWidget(); if (!widget) { // the widget doesn't exist, so don't wake it up diff --git a/packages/git/src/browser/history/git-history-frontend-module.ts b/packages/git/src/browser/history/git-history-frontend-module.ts index aca263fa5cc41..a9ae42b4a4814 100644 --- a/packages/git/src/browser/history/git-history-frontend-module.ts +++ b/packages/git/src/browser/history/git-history-frontend-module.ts @@ -24,7 +24,7 @@ import '../../../src/browser/style/history.css'; import '../../../src/browser/style/git-icons.css'; import { GitCommitDetailOpenHandler } from './git-commit-detail-open-handler'; -export function bindGitHistoryModule(bind: interfaces.Bind) { +export function bindGitHistoryModule(bind: interfaces.Bind): void { bind(GitHistoryWidget).toSelf(); bind(WidgetFactory).toDynamicValue(ctx => ({ diff --git a/packages/git/src/browser/history/git-history-widget.tsx b/packages/git/src/browser/history/git-history-widget.tsx index ea2d72c3c4066..37fe84c55bcb4 100644 --- a/packages/git/src/browser/history/git-history-widget.tsx +++ b/packages/git/src/browser/history/git-history-widget.tsx @@ -108,7 +108,7 @@ export class GitHistoryWidget extends GitNavigableListWidget super.update(); } - async setContent(options?: Git.Options.Log) { + async setContent(options?: Git.Options.Log): Promise { this.resetState(options); if (options && options.uri) { const fileStat = await this.fileSystem.getFileStat(options.uri); @@ -121,7 +121,7 @@ export class GitHistoryWidget extends GitNavigableListWidget } } - protected resetState(options?: Git.Options.Log) { + protected resetState(options?: Git.Options.Log): void { this.options = options || {}; this.status = { state: 'loading' }; this.gitNodes = []; @@ -191,7 +191,7 @@ export class GitHistoryWidget extends GitNavigableListWidget } } - protected async addOrRemoveFileChangeNodes(commit: GitCommitNode) { + protected async addOrRemoveFileChangeNodes(commit: GitCommitNode): Promise { const id = this.gitNodes.findIndex(node => node === commit); if (commit.expanded) { this.removeFileChangeNodes(commit, id); @@ -202,7 +202,7 @@ export class GitHistoryWidget extends GitNavigableListWidget this.update(); } - protected async addFileChangeNodes(commit: GitCommitNode, gitNodesArrayIndex: number) { + protected async addFileChangeNodes(commit: GitCommitNode, gitNodesArrayIndex: number): Promise { if (commit.fileChanges) { const fileChangeNodes: GitFileChangeNode[] = []; await Promise.all(commit.fileChanges.map(async fileChange => { @@ -219,7 +219,7 @@ export class GitHistoryWidget extends GitNavigableListWidget } } - protected removeFileChangeNodes(commit: GitCommitNode, gitNodesArrayIndex: number) { + protected removeFileChangeNodes(commit: GitCommitNode, gitNodesArrayIndex: number): void { if (commit.fileChanges) { this.gitNodes.splice(gitNodesArrayIndex + 1, commit.fileChanges.length); } @@ -325,7 +325,7 @@ export class GitHistoryWidget extends GitNavigableListWidget } protected readonly handleScroll = (info: ScrollParams) => this.doHandleScroll(info); - protected doHandleScroll(info: ScrollParams) { + protected doHandleScroll(info: ScrollParams): void { this.node.scrollTop = info.scrollTop; } @@ -401,7 +401,7 @@ export class GitHistoryWidget extends GitNavigableListWidget ; } - protected async openDetailWidget(commit: GitCommitNode) { + protected async openDetailWidget(commit: GitCommitNode): Promise { const commitDetails = this.detailOpenHandler.getCommitDetailWidgetOptions(commit); this.detailOpenHandler.open(GitCommitDetailUri.toUri(commit.commitSha), { ...commitDetails @@ -490,7 +490,7 @@ export class GitHistoryWidget extends GitNavigableListWidget this.update(); } - protected openFile(change: GitFileChange, commitSha: string) { + protected openFile(change: GitFileChange, commitSha: string): void { const uri: URI = new URI(change.uri); let fromURI = change.oldUri ? new URI(change.oldUri) : uri; // set oldUri on renamed and copied fromURI = fromURI.withScheme(GIT_RESOURCE_SCHEME).withQuery(commitSha + '~1'); @@ -523,7 +523,7 @@ export class GitHistoryList extends React.Component { list: List | undefined; protected readonly checkIfRowIsLoaded = (opts: { index: number }) => this.doCheckIfRowIsLoaded(opts); - protected doCheckIfRowIsLoaded(opts: { index: number }) { + protected doCheckIfRowIsLoaded(opts: { index: number }): boolean { const row = this.props.rows[opts.index]; return !!row; } diff --git a/packages/git/src/node/dugite-git-watcher.slow-spec.ts b/packages/git/src/node/dugite-git-watcher.slow-spec.ts index edb1173e9f687..c04f56aa24fb7 100644 --- a/packages/git/src/node/dugite-git-watcher.slow-spec.ts +++ b/packages/git/src/node/dugite-git-watcher.slow-spec.ts @@ -37,7 +37,7 @@ describe('git-watcher-slow', () => { let repository: Repository | undefined; let watcher: GitWatcherServer | undefined; - beforeEach(async function () { + beforeEach(async function (): Promise { this.timeout(40000); const root = track.mkdirSync('git-watcher-slow'); @@ -53,12 +53,12 @@ describe('git-watcher-slow', () => { await git!.clone('https://github.com/TypeFox/find-git-exec.git', { localUri }); }); - after(function () { + after(function (): void { this.timeout(40000); track.cleanupSync(); }); - it('watching the same repository multiple times should not duplicate the events', async function () { + it('watching the same repository multiple times should not duplicate the events', async function (): Promise { this.timeout(40000); let ignoredEvents = 1; @@ -99,6 +99,6 @@ describe('git-watcher-slow', () => { }); -function sleep(time: number) { +function sleep(time: number): Promise { return new Promise(resolve => setTimeout(resolve, time)); } diff --git a/packages/git/src/node/dugite-git.slow-spec.ts b/packages/git/src/node/dugite-git.slow-spec.ts index 6ae69fe2f2290..a9e40a85c886e 100644 --- a/packages/git/src/node/dugite-git.slow-spec.ts +++ b/packages/git/src/node/dugite-git.slow-spec.ts @@ -24,7 +24,7 @@ import { createGit } from './test/binding-helper'; const track = temp.track(); -describe('git-slow', async function () { +describe('git-slow', async function (): Promise { after(async () => { track.cleanupSync(); @@ -32,7 +32,7 @@ describe('git-slow', async function () { describe('diff-slow', async () => { - it('diff with rename/move', async function () { + it('diff with rename/move', async function (): Promise { this.timeout(50000); const root = track.mkdirSync('diff-slow-rename'); diff --git a/packages/git/src/node/dugite-git.spec.ts b/packages/git/src/node/dugite-git.spec.ts index 7dd651fa28d94..9c3a020270006 100644 --- a/packages/git/src/node/dugite-git.spec.ts +++ b/packages/git/src/node/dugite-git.spec.ts @@ -33,7 +33,7 @@ import { createGit } from './test/binding-helper'; const track = temp.track(); -describe('git', async function () { +describe('git', async function (): Promise { this.timeout(10000); @@ -765,7 +765,7 @@ describe('git', async function () { }); -describe('log', function () { +describe('log', function (): void { // See https://github.com/theia-ide/theia/issues/2143 it('should not fail when executed from the repository root', async () => { diff --git a/packages/git/src/node/dugite-git.ts b/packages/git/src/node/dugite-git.ts index cc2be3d450fb7..7706cd053a2ef 100644 --- a/packages/git/src/node/dugite-git.ts +++ b/packages/git/src/node/dugite-git.ts @@ -238,7 +238,7 @@ export namespace GitBlameParser { summary?: string, } - export function isUncommittedSha(sha: string | undefined) { + export function isUncommittedSha(sha: string | undefined): boolean { return (sha || '').startsWith('0000000'); } @@ -728,7 +728,8 @@ export class DugiteGit implements Git { async lsFiles(repository: Repository, uri: string, options?: Git.Options.LsFiles): Promise { await this.ready.promise; const args = ['ls-files']; - const file = Path.relative(this.getFsPath(repository), this.getFsPath(uri)); + const relativePath = Path.relative(this.getFsPath(repository), this.getFsPath(uri)); + const file = (relativePath === '') ? '.' : relativePath; if (options && options.errorUnmatch) { args.push('--error-unmatch', file); const successExitCodes = new Set([0, 1]); @@ -808,7 +809,7 @@ export class DugiteGit implements Git { return this.mapBranch(branch); } - private getResetMode(mode: 'hard' | 'soft' | 'mixed') { + private getResetMode(mode: 'hard' | 'soft' | 'mixed'): GitResetMode { switch (mode) { case 'hard': return GitResetMode.Hard; case 'soft': return GitResetMode.Soft; diff --git a/packages/git/src/node/git-locator/git-locator-impl.ts b/packages/git/src/node/git-locator/git-locator-impl.ts index dba0feff45e88..e84da6088c6ec 100644 --- a/packages/git/src/node/git-locator/git-locator-impl.ts +++ b/packages/git/src/node/git-locator/git-locator-impl.ts @@ -89,7 +89,7 @@ export class GitLocatorImpl implements GitLocator { }); } - protected * generateNested(repositoryPaths: string[], context: GitLocateContext) { + protected * generateNested(repositoryPaths: string[], context: GitLocateContext): IterableIterator> { for (const repository of repositoryPaths) { yield this.locateNested(repository, context); } @@ -110,7 +110,7 @@ export class GitLocatorImpl implements GitLocator { }); } - protected * generateRepositories(repositoryPath: string, files: string[], context: GitLocateContext) { + protected * generateRepositories(repositoryPath: string, files: string[], context: GitLocateContext): IterableIterator> { for (const file of files) { if (file !== '.git') { yield this.doLocate(path.join(repositoryPath, file), { diff --git a/packages/java-debug/src/browser/java-debug-frontend-contribution.ts b/packages/java-debug/src/browser/java-debug-frontend-contribution.ts index d6da21b7b0c2d..1fec3f790a2e9 100644 --- a/packages/java-debug/src/browser/java-debug-frontend-contribution.ts +++ b/packages/java-debug/src/browser/java-debug-frontend-contribution.ts @@ -38,6 +38,13 @@ enum HcrChangeType { BUILD_COMPLETE = 'BUILD_COMPLETE', } +enum LogLevel { + FINE = 'FINE', + INFO = 'INFO', + SEVERE = 'SEVERE', + WARNING = 'WARNING' +} + export namespace JavaDebugCommands { export const RUN: Command = { id: 'java.debug.run' @@ -238,19 +245,19 @@ export class JavaDebugFrontendContribution implements FrontendApplicationContrib } } } - protected convertLogLevel(commonLogLevel: string) { + protected convertLogLevel(commonLogLevel: string): LogLevel { // convert common log level to java log level switch (commonLogLevel.toLowerCase()) { case 'verbose': - return 'FINE'; + return LogLevel.FINE; case 'warn': - return 'WARNING'; + return LogLevel.WARNING; case 'error': - return 'SEVERE'; + return LogLevel.SEVERE; case 'info': - return 'INFO'; + return LogLevel.INFO; default: - return 'FINE'; + return LogLevel.FINE; } } diff --git a/packages/java/src/browser/java-client-contribution.ts b/packages/java/src/browser/java-client-contribution.ts index aac057fa99c1e..df25187d1591b 100644 --- a/packages/java/src/browser/java-client-contribution.ts +++ b/packages/java/src/browser/java-client-contribution.ts @@ -65,15 +65,15 @@ export class JavaClientContribution extends BaseLanguageClientContribution { super(workspace, languages, languageClientFactory); } - protected get globPatterns() { + protected get globPatterns(): string[] { return ['**/*.java', '**/pom.xml', '**/*.gradle']; } - protected get workspaceContains() { + protected get workspaceContains(): string[] { return ['pom.xml', 'build.gradle']; } - get configurationSection() { + get configurationSection(): string { return 'java'; } @@ -90,7 +90,7 @@ export class JavaClientContribution extends BaseLanguageClientContribution { return client; } - protected showStatusMessage(message: StatusReport) { + protected showStatusMessage(message: StatusReport): void { if (this.statusBarTimeout) { window.clearTimeout(this.statusBarTimeout); this.statusBarTimeout = undefined; @@ -135,7 +135,7 @@ export class JavaClientContribution extends BaseLanguageClientContribution { return { workspace, jvmArgs }; } - private parseVMargs(params: string[], vmargsLine: string) { + private parseVMargs(params: string[], vmargsLine: string): void { if (!vmargsLine) { return; } diff --git a/packages/json/src/browser/json-client-contribution.ts b/packages/json/src/browser/json-client-contribution.ts index 7b2cd627ce159..1bac6a76b9136 100644 --- a/packages/json/src/browser/json-client-contribution.ts +++ b/packages/json/src/browser/json-client-contribution.ts @@ -79,7 +79,7 @@ export class JsonClientContribution extends BaseLanguageClientContribution { client.sendNotification('json/schemaAssociations', registry); } - protected get globPatterns() { + protected get globPatterns(): string[] { return [ '**/*.json', '**/*.jsonc', diff --git a/packages/json/src/browser/json-grammar-contribution.ts b/packages/json/src/browser/json-grammar-contribution.ts index f91058239de8c..ff973af6909b8 100644 --- a/packages/json/src/browser/json-grammar-contribution.ts +++ b/packages/json/src/browser/json-grammar-contribution.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; import { JSON_LANGUAGE_ID, JSONC_LANGUAGE_ID } from '../common'; @@ -41,7 +41,7 @@ export class JsonGrammarContribution implements LanguageGrammarDefinitionContrib ] }; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: JSON_LANGUAGE_ID, 'aliases': [ @@ -73,7 +73,7 @@ export class JsonGrammarContribution implements LanguageGrammarDefinitionContrib const jsonGrammar = require('../../data/json.tmLanguage.json'); registry.registerTextmateGrammarScope('source.json', { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: jsonGrammar @@ -98,7 +98,7 @@ export class JsonGrammarContribution implements LanguageGrammarDefinitionContrib const jsoncGrammar = require('../../data/jsonc.tmLanguage.json'); registry.registerTextmateGrammarScope('source.json.comments', { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: jsoncGrammar diff --git a/packages/keymaps/src/browser/keybindings-widget.tsx b/packages/keymaps/src/browser/keybindings-widget.tsx index 2be9fe05c5787..0388651e74d1d 100644 --- a/packages/keymaps/src/browser/keybindings-widget.tsx +++ b/packages/keymaps/src/browser/keybindings-widget.tsx @@ -151,7 +151,7 @@ export class KeybindingWidget extends ReactWidget { } } - protected onActivateRequest(msg: Message) { + protected onActivateRequest(msg: Message): void { super.onActivateRequest(msg); this.focusInputField(); } diff --git a/packages/keymaps/src/browser/keymaps-parser.ts b/packages/keymaps/src/browser/keymaps-parser.ts index eb3d133a1e215..8b545064cb1f7 100644 --- a/packages/keymaps/src/browser/keymaps-parser.ts +++ b/packages/keymaps/src/browser/keymaps-parser.ts @@ -76,6 +76,7 @@ export class KeymapsParser { } // https://github.com/Microsoft/node-jsonc-parser/issues/13 + // tslint:disable-next-line:typedef protected printParseErrorCode(code: number | undefined) { switch (code) { case parser.ParseErrorCode.InvalidSymbol: return 'InvalidSymbol'; diff --git a/packages/keymaps/src/browser/keymaps-service.ts b/packages/keymaps/src/browser/keymaps-service.ts index c89ec7018bea8..bb7ea5cfb2b45 100644 --- a/packages/keymaps/src/browser/keymaps-service.ts +++ b/packages/keymaps/src/browser/keymaps-service.ts @@ -50,7 +50,7 @@ export class KeymapsService { protected resource: Resource; @postConstruct() - protected async init() { + protected async init(): Promise { this.resource = await this.resourceProvider(new URI().withScheme(UserStorageUri.SCHEME).withPath('keymaps.json')); this.reconcile(); if (this.resource.onDidChangeContents) { diff --git a/packages/languages/src/browser/workspace-symbols.ts b/packages/languages/src/browser/workspace-symbols.ts index 24be9d9267bc6..8f64b1708654e 100644 --- a/packages/languages/src/browser/workspace-symbols.ts +++ b/packages/languages/src/browser/workspace-symbols.ts @@ -41,11 +41,11 @@ export class WorkspaceSymbolCommand implements QuickOpenModel, CommandContributi @inject(PrefixQuickOpenService) protected quickOpenService: PrefixQuickOpenService, @inject(SelectionService) protected selectionService: SelectionService) { } - isEnabled() { + isEnabled(): boolean { return this.languages.workspaceSymbolProviders !== undefined; } - execute() { + execute(): void { this.quickOpenService.open(this.prefix); } diff --git a/packages/languages/src/node/language-server-contribution.ts b/packages/languages/src/node/language-server-contribution.ts index 9db3dd6a411bb..4dd2662c82de3 100644 --- a/packages/languages/src/node/language-server-contribution.ts +++ b/packages/languages/src/node/language-server-contribution.ts @@ -128,13 +128,13 @@ export abstract class BaseLanguageServerContribution implements LanguageServerCo console.error(error); } - protected logError(data: string | Buffer) { + protected logError(data: string | Buffer): void { if (data) { console.error(`${this.name}: ${data}`); } } - protected logInfo(data: string | Buffer) { + protected logInfo(data: string | Buffer): void { if (data) { console.info(`${this.name}: ${data}`); } diff --git a/packages/markers/src/browser/marker-manager.ts b/packages/markers/src/browser/marker-manager.ts index e83f800af9140..312909866a914 100644 --- a/packages/markers/src/browser/marker-manager.ts +++ b/packages/markers/src/browser/marker-manager.ts @@ -84,7 +84,7 @@ export class MarkerCollection { } } - protected filterMarkers(filter: SearchFilter, toFilter?: Marker[]) { + protected filterMarkers(filter: SearchFilter, toFilter?: Marker[]): Marker[] { if (!toFilter) { return []; } diff --git a/packages/markers/src/browser/problem/problem-contribution.ts b/packages/markers/src/browser/problem/problem-contribution.ts index 55dbda343ecce..adf972d4e8128 100644 --- a/packages/markers/src/browser/problem/problem-contribution.ts +++ b/packages/markers/src/browser/problem/problem-contribution.ts @@ -69,7 +69,7 @@ export class ProblemContribution extends AbstractViewContribution }); } - onStart(app: FrontendApplication) { + onStart(app: FrontendApplication): void { this.setStatusBarElement(this.problemManager.getProblemStat()); this.problemManager.onDidChangeMarkers(() => { this.setStatusBarElement(this.problemManager.getProblemStat()); @@ -80,7 +80,7 @@ export class ProblemContribution extends AbstractViewContribution await this.openView(); } - protected setStatusBarElement(problemStat: ProblemStat) { + protected setStatusBarElement(problemStat: ProblemStat): void { this.statusBar.setElement('problem-marker-status', { text: problemStat.infos <= 0 ? `$(times-circle) ${problemStat.errors} $(exclamation-triangle) ${problemStat.warnings}` diff --git a/packages/markers/src/browser/problem/problem-manager.ts b/packages/markers/src/browser/problem/problem-manager.ts index 0bae5e8a2417c..de0d2c195cc3c 100644 --- a/packages/markers/src/browser/problem/problem-manager.ts +++ b/packages/markers/src/browser/problem/problem-manager.ts @@ -30,7 +30,7 @@ export interface ProblemStat { @injectable() export class ProblemManager extends MarkerManager { - public getKind() { + public getKind(): string { return PROBLEM_KIND; } diff --git a/packages/markers/src/browser/problem/problem-tree-model.ts b/packages/markers/src/browser/problem/problem-tree-model.ts index 2e8b1af71da43..92d8aea3a95c9 100644 --- a/packages/markers/src/browser/problem/problem-tree-model.ts +++ b/packages/markers/src/browser/problem/problem-tree-model.ts @@ -47,7 +47,7 @@ export class ProblemTreeModel extends MarkerTreeModel { return undefined; } - removeNode(node: TreeNode) { + removeNode(node: TreeNode): void { if (MarkerInfoNode.is(node)) { this.problemManager.cleanAllMarkers(node.uri); } diff --git a/packages/markers/src/browser/problem/problem-widget.tsx b/packages/markers/src/browser/problem/problem-widget.tsx index 04d42a09c4987..b5f9ff25c41e3 100644 --- a/packages/markers/src/browser/problem/problem-widget.tsx +++ b/packages/markers/src/browser/problem/problem-widget.tsx @@ -68,7 +68,7 @@ export class ProblemWidget extends TreeWidget { } } - protected handleCopy(event: ClipboardEvent) { + protected handleCopy(event: ClipboardEvent): void { const uris = this.model.selectedNodes.filter(MarkerNode.is).map(node => node.uri.toString()); if (uris.length > 0 && event.clipboardData) { event.clipboardData.setData('text/plain', uris.join('\n')); @@ -108,7 +108,7 @@ export class ProblemWidget extends TreeWidget { return 'caption'; } - protected renderTailDecorations(node: TreeNode, props: NodeProps) { + protected renderTailDecorations(node: TreeNode, props: NodeProps): JSX.Element { return
{this.renderRemoveButton(node)}
; @@ -176,7 +176,7 @@ export class ProblemMarkerRemoveButton extends React.Component<{ model: ProblemT } protected readonly remove = (e: React.MouseEvent) => this.doRemove(e); - protected doRemove(e: React.MouseEvent) { + protected doRemove(e: React.MouseEvent): void { this.props.model.removeNode(this.props.node); e.stopPropagation(); } diff --git a/packages/merge-conflicts/src/browser/merge-conflict-resolver.ts b/packages/merge-conflicts/src/browser/merge-conflict-resolver.ts index 6b3f4b30637a5..d6c8df6878f43 100644 --- a/packages/merge-conflicts/src/browser/merge-conflict-resolver.ts +++ b/packages/merge-conflicts/src/browser/merge-conflict-resolver.ts @@ -39,17 +39,17 @@ export class MergeConflictResolver { execute: args => this.doAcceptBoth(args) }; - protected doAcceptCurrent(argument: MergeConflictCommandArgument) { + protected doAcceptCurrent(argument: MergeConflictCommandArgument): void { this.doAccept(argument, (textOfRange, conflict) => textOfRange(conflict.current.content!)); } - protected doAcceptIncoming(argument: MergeConflictCommandArgument) { + protected doAcceptIncoming(argument: MergeConflictCommandArgument): void { this.doAccept(argument, (textOfRange, conflict) => textOfRange(conflict.incoming.content!)); } - protected doAcceptBoth(argument: MergeConflictCommandArgument) { + protected doAcceptBoth(argument: MergeConflictCommandArgument): void { this.doAccept(argument, (textOfRange, conflict) => { const currentText = textOfRange(conflict.current.content); const incomingText = textOfRange(conflict.incoming.content); @@ -57,7 +57,8 @@ export class MergeConflictResolver { }); } - protected async doAccept(argument: MergeConflictCommandArgument, newTextFn: ((textOfRange: (range: Range | undefined) => string, conflict: MergeConflict) => string)) { + protected async doAccept(argument: MergeConflictCommandArgument, + newTextFn: ((textOfRange: (range: Range | undefined) => string, conflict: MergeConflict) => string)): Promise { const { uri, conflict } = argument; const editorWidget = await this.editorManager.getByUri(new URI(uri)); if (!editorWidget) { diff --git a/packages/merge-conflicts/src/browser/merge-conflicts-provider.ts b/packages/merge-conflicts/src/browser/merge-conflicts-provider.ts index 7f5509dcd3e9e..e452f57fff919 100644 --- a/packages/merge-conflicts/src/browser/merge-conflicts-provider.ts +++ b/packages/merge-conflicts/src/browser/merge-conflicts-provider.ts @@ -39,7 +39,7 @@ export class MergeConflictsProvider { protected valueTimeouts = new Map(); @postConstruct() - protected initialize() { + protected initialize(): void { this.editorManager.onCreated(w => this.handleNewEditor(w)); } diff --git a/packages/metrics/src/node/metrics-backend-application-contribution.ts b/packages/metrics/src/node/metrics-backend-application-contribution.ts index 45c7b4bca57b8..0f6eee239f99b 100644 --- a/packages/metrics/src/node/metrics-backend-application-contribution.ts +++ b/packages/metrics/src/node/metrics-backend-application-contribution.ts @@ -30,7 +30,7 @@ export class MetricsBackendApplicationContribution implements BackendApplication ) { } - configure(app: express.Application) { + configure(app: express.Application): void { app.get('/metrics', (req, res) => { const lastMetrics = this.fetchMetricsFromProviders(); res.send(lastMetrics); diff --git a/packages/mini-browser/src/browser/mini-browser-content.ts b/packages/mini-browser/src/browser/mini-browser-content.ts index fc1ac42b4b73c..ed6e04d83acf3 100644 --- a/packages/mini-browser/src/browser/mini-browser-content.ts +++ b/packages/mini-browser/src/browser/mini-browser-content.ts @@ -524,7 +524,7 @@ export class MiniBrowserContent extends BaseWidget { } } - protected frameSrc() { + protected frameSrc(): string { let src = this.frame.src; try { const { contentWindow } = this.frame; diff --git a/packages/monaco/src/browser/monaco-command-service.ts b/packages/monaco/src/browser/monaco-command-service.ts index a75fbd3856ee6..c220874495621 100644 --- a/packages/monaco/src/browser/monaco-command-service.ts +++ b/packages/monaco/src/browser/monaco-command-service.ts @@ -40,7 +40,7 @@ export class MonacoCommandService implements ICommandService { return this._onWillExecuteCommand.event; } - setDelegate(delegate: ICommandService | undefined) { + setDelegate(delegate: ICommandService | undefined): void { this.delegateListeners.dispose(); this.delegate = delegate; if (this.delegate) { diff --git a/packages/monaco/src/browser/monaco-editor-model.ts b/packages/monaco/src/browser/monaco-editor-model.ts index 83dac83a3c1af..a6dd459735953 100644 --- a/packages/monaco/src/browser/monaco-editor-model.ts +++ b/packages/monaco/src/browser/monaco-editor-model.ts @@ -126,7 +126,7 @@ export class MonacoEditorModel implements ITextEditorModel, TextEditorDocument { /** * It's a hack to dispatch close notification with an old language id, don't use it. */ - setLanguageId(languageId: string | undefined) { + setLanguageId(languageId: string | undefined): void { this._languageId = languageId; } diff --git a/packages/monaco/src/browser/monaco-editor-provider.ts b/packages/monaco/src/browser/monaco-editor-provider.ts index 9d5741bedd8fc..56cb15fdf1dec 100644 --- a/packages/monaco/src/browser/monaco-editor-provider.ts +++ b/packages/monaco/src/browser/monaco-editor-provider.ts @@ -243,7 +243,9 @@ export class MonacoEditorProvider { }, {}); } - protected setOption(preferenceName: string, value: any, prefixes: string[], options: { [name: string]: any } = {}) { + protected setOption(preferenceName: string, value: any, prefixes: string[], options: { [name: string]: any } = {}): { + [name: string]: any; + } { const optionName = this.toOptionName(preferenceName, prefixes); this.doSetOption(options, value, optionName.split('.')); return options; diff --git a/packages/monaco/src/browser/monaco-editor.ts b/packages/monaco/src/browser/monaco-editor.ts index 3b9f1555bce33..b2fa80a8e2d0b 100644 --- a/packages/monaco/src/browser/monaco-editor.ts +++ b/packages/monaco/src/browser/monaco-editor.ts @@ -158,7 +158,7 @@ export class MonacoEditor implements TextEditor { }; } - get onDispose() { + get onDispose(): Event { return this.toDispose.onDispose; } @@ -230,7 +230,7 @@ export class MonacoEditor implements TextEditor { } } - focus() { + focus(): void { this.editor.focus(); } @@ -280,11 +280,11 @@ export class MonacoEditor implements TextEditor { return this.editor.getContribution('editor.contrib.renameController')._renameInputVisible.get(); } - dispose() { + dispose(): void { this.toDispose.dispose(); } - getControl() { + getControl(): IStandaloneCodeEditor { return this.editor; } @@ -300,7 +300,7 @@ export class MonacoEditor implements TextEditor { this.resize(dimension); } - protected autoresize() { + protected autoresize(): void { if (this.autoSizing) { // tslint:disable-next-line:no-null-keyword this.resize(null); diff --git a/packages/monaco/src/browser/monaco-frontend-application-contribution.ts b/packages/monaco/src/browser/monaco-frontend-application-contribution.ts index a982ffd95bb8e..5ee145ad1073a 100644 --- a/packages/monaco/src/browser/monaco-frontend-application-contribution.ts +++ b/packages/monaco/src/browser/monaco-frontend-application-contribution.ts @@ -27,7 +27,7 @@ export class MonacoFrontendApplicationContribution implements FrontendApplicatio @inject(PreferenceSchemaProvider) protected readonly preferenceSchema: PreferenceSchemaProvider; - async initialize() { + async initialize(): Promise { monaco.suggest.setSnippetSuggestSupport(this.snippetSuggestProvider); for (const language of monaco.languages.getLanguages()) { diff --git a/packages/monaco/src/browser/monaco-keycode-map.ts b/packages/monaco/src/browser/monaco-keycode-map.ts index 5f08c95815b4e..5d7aefc640674 100644 --- a/packages/monaco/src/browser/monaco-keycode-map.ts +++ b/packages/monaco/src/browser/monaco-keycode-map.ts @@ -23,7 +23,7 @@ import * as browser from '@theia/core/lib/browser'; const KeyCode = monaco.KeyCode; export let KEY_CODE_MAP: monaco.KeyCode[] = []; -(function () { +(function (): void { KEY_CODE_MAP[3] = KeyCode.PauseBreak; // VK_CANCEL 0x03 Control-break processing KEY_CODE_MAP[8] = KeyCode.Backspace; KEY_CODE_MAP[9] = KeyCode.Tab; diff --git a/packages/monaco/src/browser/monaco-menu.ts b/packages/monaco/src/browser/monaco-menu.ts index 14655a34d2173..c499b614455cb 100644 --- a/packages/monaco/src/browser/monaco-menu.ts +++ b/packages/monaco/src/browser/monaco-menu.ts @@ -74,7 +74,7 @@ export class MonacoEditorMenuContribution implements MenuContribution { @inject(MonacoCommandRegistry) protected readonly commands: MonacoCommandRegistry ) { } - registerMenus(registry: MenuModelRegistry) { + registerMenus(registry: MenuModelRegistry): void { for (const item of MenuRegistry.getMenuItems(MenuId.EditorContext)) { const commandId = this.commands.validate(item.command.id); if (commandId) { diff --git a/packages/monaco/src/browser/monaco-quick-open-service.ts b/packages/monaco/src/browser/monaco-quick-open-service.ts index c61576b6d2e71..a971abf5bfc7e 100644 --- a/packages/monaco/src/browser/monaco-quick-open-service.ts +++ b/packages/monaco/src/browser/monaco-quick-open-service.ts @@ -541,7 +541,7 @@ export class MonacoQuickOpenActionProvider implements monaco.quickOpen.IActionPr return monaco.Promise.wrap([]); } - getActionItem() { + getActionItem(): undefined { return undefined; } } @@ -571,7 +571,13 @@ class TheiaResolvedKeybinding extends monaco.keybindings.ResolvedKeybinding { })); } - private getKeyAndModifiers(index: number) { + private getKeyAndModifiers(index: number): { + key: string | null; + modifiers: monaco.keybindings.Modifiers; + } | { + key: null; + modifiers: null; + } { if (index >= this.parts.length) { // tslint:disable-next-line:no-null-keyword return { key: null, modifiers: null }; diff --git a/packages/monaco/src/browser/monaco-status-bar-contribution.ts b/packages/monaco/src/browser/monaco-status-bar-contribution.ts index bbd8800f00f7b..455b0148491f5 100644 --- a/packages/monaco/src/browser/monaco-status-bar-contribution.ts +++ b/packages/monaco/src/browser/monaco-status-bar-contribution.ts @@ -60,7 +60,7 @@ export class MonacoStatusBarContribution implements FrontendApplicationContribut } } - protected setConfigTabSizeWidget() { + protected setConfigTabSizeWidget(): void { const editor = this.editorManager.currentEditor; const editorModel = this.getModel(editor); if (editor && editorModel) { @@ -75,11 +75,11 @@ export class MonacoStatusBarContribution implements FrontendApplicationContribut }); } } - protected removeConfigTabSizeWidget() { + protected removeConfigTabSizeWidget(): void { this.statusBar.removeElement('editor-status-tabbing-config'); } - protected setLineEndingWidget() { + protected setLineEndingWidget(): void { const editor = this.editorManager.currentEditor; const editorModel = this.getModel(editor); if (editor && editorModel) { @@ -93,7 +93,7 @@ export class MonacoStatusBarContribution implements FrontendApplicationContribut }); } } - protected removeLineEndingWidget() { + protected removeLineEndingWidget(): void { this.statusBar.removeElement('editor-status-eol'); } diff --git a/packages/monaco/src/browser/monaco-workspace.ts b/packages/monaco/src/browser/monaco-workspace.ts index f4e89bc6af21a..3456b470f76b4 100644 --- a/packages/monaco/src/browser/monaco-workspace.ts +++ b/packages/monaco/src/browser/monaco-workspace.ts @@ -308,7 +308,7 @@ export class MonacoWorkspace implements lang.Workspace { return editorEdits; } - protected checkVersions(editorEdits: EditsByEditor[]) { + protected checkVersions(editorEdits: EditsByEditor[]): void { editorEdits.forEach(editorEdit => { if (!editorEdit.editor) { throw Error(`Could not open editor for ${editorEdit.uri}`); @@ -330,7 +330,7 @@ export class MonacoWorkspace implements lang.Workspace { return `Made ${totalEdits} text edits in one file`; } - protected groupEdits(workspaceEdit: monaco.languages.WorkspaceEdit) { + protected groupEdits(workspaceEdit: monaco.languages.WorkspaceEdit): EditsByEditor[] { const map = new Map(); const result: EditsByEditor[] = []; for (const edit of workspaceEdit.edits) { diff --git a/packages/monaco/src/browser/textmate/monaco-textmate-frontend-bindings.ts b/packages/monaco/src/browser/textmate/monaco-textmate-frontend-bindings.ts index 8b7e58e0ac8d2..0e8bf3e634e48 100644 --- a/packages/monaco/src/browser/textmate/monaco-textmate-frontend-bindings.ts +++ b/packages/monaco/src/browser/textmate/monaco-textmate-frontend-bindings.ts @@ -29,7 +29,7 @@ export function fetchOnigasm(): Promise { const onigasmPath = require('onigasm/lib/onigasm.wasm'); // webpack doing its magic here const request = new XMLHttpRequest(); - request.onreadystatechange = function () { + request.onreadystatechange = function (): void { if (this.readyState === XMLHttpRequest.DONE) { if (this.status === 200) { resolve(this.response); diff --git a/packages/monaco/src/browser/textmate/monaco-textmate-service.ts b/packages/monaco/src/browser/textmate/monaco-textmate-service.ts index 52df93361c77a..e76e26970725b 100644 --- a/packages/monaco/src/browser/textmate/monaco-textmate-service.ts +++ b/packages/monaco/src/browser/textmate/monaco-textmate-service.ts @@ -58,7 +58,7 @@ export class MonacoTextmateService implements FrontendApplicationContribution { @inject(MonacoThemeRegistry) protected readonly monacoThemeRegistry: MonacoThemeRegistry; - initialize() { + initialize(): void { if (!isBasicWasmSupported) { console.log('Textmate support deactivated because WebAssembly is not detected.'); return; @@ -129,7 +129,7 @@ export class MonacoTextmateService implements FrontendApplicationContribution { return this.themeService.getCurrentTheme().editorTheme || MonacoThemeRegistry.DARK_DEFAULT_THEME; } - async activateLanguage(languageId: string) { + async activateLanguage(languageId: string): Promise { if (this._activatedLanguages.has(languageId)) { return; } diff --git a/packages/monaco/src/browser/textmate/monaco-theme-registry.ts b/packages/monaco/src/browser/textmate/monaco-theme-registry.ts index 3b448998d7484..18465aa331150 100644 --- a/packages/monaco/src/browser/textmate/monaco-theme-registry.ts +++ b/packages/monaco/src/browser/textmate/monaco-theme-registry.ts @@ -85,7 +85,7 @@ export class MonacoThemeRegistry { return result; } - protected transform(tokenColor: any, acceptor: (rule: monaco.editor.ITokenThemeRule) => void) { + protected transform(tokenColor: any, acceptor: (rule: monaco.editor.ITokenThemeRule) => void): void { if (typeof tokenColor.scope === 'undefined') { tokenColor.scope = ['']; } else if (typeof tokenColor.scope === 'string') { diff --git a/packages/monaco/src/browser/textmate/textmate-tokenizer.ts b/packages/monaco/src/browser/textmate/textmate-tokenizer.ts index ab0d8c2e8480e..62b5cc048bec0 100644 --- a/packages/monaco/src/browser/textmate/textmate-tokenizer.ts +++ b/packages/monaco/src/browser/textmate/textmate-tokenizer.ts @@ -63,7 +63,7 @@ export function createTextmateTokenizer(grammar: IGrammar, options: TokenizerOpt } return { getInitialState: () => new TokenizerState(INITIAL), - tokenizeEncoded(line: string, state: TokenizerState) { + tokenizeEncoded(line: string, state: TokenizerState): monaco.languages.IEncodedLineTokens { let processedLine = line; if (options.lineLimit !== undefined && line.length > options.lineLimit) { // Line is too long to be tokenized diff --git a/packages/navigator/src/browser/navigator-contribution.ts b/packages/navigator/src/browser/navigator-contribution.ts index 0edfb7cf173fa..8c18fcaa7321a 100644 --- a/packages/navigator/src/browser/navigator-contribution.ts +++ b/packages/navigator/src/browser/navigator-contribution.ts @@ -119,7 +119,7 @@ export class FileNavigatorContribution extends AbstractViewContribution { await this.fileNavigatorPreferences.ready; this.shell.currentChanged.connect(() => this.onCurrentWidgetChangedHandler()); diff --git a/packages/navigator/src/browser/navigator-filter.spec.ts b/packages/navigator/src/browser/navigator-filter.spec.ts index ed7b306fb8d2a..839dddb5f59b8 100644 --- a/packages/navigator/src/browser/navigator-filter.spec.ts +++ b/packages/navigator/src/browser/navigator-filter.spec.ts @@ -139,10 +139,10 @@ describe('navigator-filter-glob', () => { }); -function includes(array: T[], item: T, message: string = `Expected ${JSON.stringify(array)} to include ${JSON.stringify(item)}.`) { +function includes(array: T[], item: T, message: string = `Expected ${JSON.stringify(array)} to include ${JSON.stringify(item)}.`): void { expect(array).to.deep.include(item, message); } -function excludes(array: T[], item: T, message: string = `Expected ${JSON.stringify(array)} to not include ${JSON.stringify(item)}.`) { +function excludes(array: T[], item: T, message: string = `Expected ${JSON.stringify(array)} to not include ${JSON.stringify(item)}.`): void { expect(array).to.not.deep.include(item, message); } diff --git a/packages/navigator/src/browser/navigator-filter.ts b/packages/navigator/src/browser/navigator-filter.ts index f9030af166a46..5a105ed643761 100644 --- a/packages/navigator/src/browser/navigator-filter.ts +++ b/packages/navigator/src/browser/navigator-filter.ts @@ -59,7 +59,7 @@ export class FileNavigatorFilter { return this.filterPredicate.filter(item); } - protected fireFilterChanged() { + protected fireFilterChanged(): void { this.emitter.fire(undefined); } diff --git a/packages/navigator/src/browser/navigator-model.ts b/packages/navigator/src/browser/navigator-model.ts index 32e6bbcebf00e..df8b43db01175 100644 --- a/packages/navigator/src/browser/navigator-model.ts +++ b/packages/navigator/src/browser/navigator-model.ts @@ -112,7 +112,7 @@ export class FileNavigatorModel extends FileTreeModel { /** * Move the given source file or directory to the given target directory. */ - async move(source: TreeNode, target: TreeNode) { + async move(source: TreeNode, target: TreeNode): Promise { if (source.parent && WorkspaceRootNode.is(source)) { // do not support moving a root folder return; diff --git a/packages/navigator/src/browser/navigator-widget.tsx b/packages/navigator/src/browser/navigator-widget.tsx index e4d680fb9ff1d..27222f8487d60 100644 --- a/packages/navigator/src/browser/navigator-widget.tsx +++ b/packages/navigator/src/browser/navigator-widget.tsx @@ -183,9 +183,11 @@ export class FileNavigatorWidget extends FileTreeWidget { if (!raw) { return; } - const uri = new URI(raw); - if (this.model.copy(uri)) { - event.preventDefault(); + for (const file of raw.split('\n')) { + const uri = new URI(file); + if (this.model.copy(uri)) { + event.preventDefault(); + } } } } @@ -193,12 +195,12 @@ export class FileNavigatorWidget extends FileTreeWidget { protected canOpenWorkspaceFileAndFolder: boolean = isOSX || !environment.electron.is(); protected readonly openWorkspace = () => this.doOpenWorkspace(); - protected doOpenWorkspace() { + protected doOpenWorkspace(): void { this.commandService.executeCommand(WorkspaceCommands.OPEN_WORKSPACE.id); } protected readonly openFolder = () => this.doOpenFolder(); - protected doOpenFolder() { + protected doOpenFolder(): void { this.commandService.executeCommand(WorkspaceCommands.OPEN_FOLDER.id); } diff --git a/packages/output/src/common/output-channel.ts b/packages/output/src/common/output-channel.ts index 6d87b13d98643..c1213f4bab76b 100644 --- a/packages/output/src/common/output-channel.ts +++ b/packages/output/src/common/output-channel.ts @@ -90,7 +90,7 @@ export class OutputChannelManager implements Disposable { return this.getChannels().filter(channel => channel.isVisible); } - public dispose() { + public dispose(): void { this.toDispose.dispose(); } diff --git a/packages/plugin-dev/src/browser/hosted-plugin-log-viewer.ts b/packages/plugin-dev/src/browser/hosted-plugin-log-viewer.ts index c8c487fa59d39..3f50ebaefe98a 100644 --- a/packages/plugin-dev/src/browser/hosted-plugin-log-viewer.ts +++ b/packages/plugin-dev/src/browser/hosted-plugin-log-viewer.ts @@ -40,7 +40,7 @@ export class HostedPluginLogViewer { } @postConstruct() - protected init() { + protected init(): void { this.channel = this.outputChannelManager.getChannel(HostedPluginLogViewer.OUTPUT_CHANNEL_NAME); this.watcher.onLogMessageEvent(event => this.logMessageEventHandler(event)); } diff --git a/packages/plugin-dev/src/browser/hosted-plugin-manager-client.ts b/packages/plugin-dev/src/browser/hosted-plugin-manager-client.ts index 9563ea2c615e5..dbbe7418b6005 100644 --- a/packages/plugin-dev/src/browser/hosted-plugin-manager-client.ts +++ b/packages/plugin-dev/src/browser/hosted-plugin-manager-client.ts @@ -119,7 +119,7 @@ export class HostedPluginManagerClient { protected readonly hostedPluginPreferences: HostedPluginPreferences; @postConstruct() - protected async init() { + protected async init(): Promise { this.openNewTabAskDialog = new OpenHostedInstanceLinkDialog(this.windowService); // is needed for case when page is loaded when hosted instance is already running. diff --git a/packages/plugin-dev/src/node/hosted-plugin-reader.ts b/packages/plugin-dev/src/node/hosted-plugin-reader.ts index 995169fec0108..a866d3bbcb49f 100644 --- a/packages/plugin-dev/src/node/hosted-plugin-reader.ts +++ b/packages/plugin-dev/src/node/hosted-plugin-reader.ts @@ -33,7 +33,7 @@ export class HostedPluginReader implements BackendApplicationContribution { @inject(HostedPluginDeployerHandler) protected deployerHandler: HostedPluginDeployerHandler; - async initialize() { + async initialize(): Promise { this.pluginReader.doGetPluginMetadata(process.env.HOSTED_PLUGIN) .then(this.hostedPlugin.resolve.bind(this.hostedPlugin)); diff --git a/packages/plugin-dev/src/node/hosted-plugins-manager.ts b/packages/plugin-dev/src/node/hosted-plugins-manager.ts index d041dff9acedd..2d47cd7c72a6d 100644 --- a/packages/plugin-dev/src/node/hosted-plugins-manager.ts +++ b/packages/plugin-dev/src/node/hosted-plugins-manager.ts @@ -107,7 +107,7 @@ export class HostedPluginsManagerImpl implements HostedPluginsManager { return Promise.resolve(); } - protected unregisterWatchScript(path: string) { + protected unregisterWatchScript(path: string): void { this.watchCompilationRegistry.delete(path); this.hostedPluginSupport.sendLog({ data: 'Compilation watcher has been stopped in ' + path, diff --git a/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts b/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts index e9d13fea1da14..a545f59d2b996 100644 --- a/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts +++ b/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts @@ -26,7 +26,7 @@ import { WebviewWidget } from '@theia/plugin-ext/lib/main/browser/webview/webvie import { ApplicationShell, NavigatableWidget, OpenerService, open, Saveable } from '@theia/core/lib/browser'; import { ResourceProvider } from '@theia/core'; import { ViewColumn } from '@theia/plugin-ext/lib/plugin/types-impl'; -import { TextDocumentShowOptions } from '@theia/plugin-ext/lib/api/model'; +import { TextDocumentShowOptions } from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; import { fromViewColumn } from '@theia/plugin-ext/lib/plugin/type-converters'; import { WorkspaceCommands } from '@theia/workspace/lib/browser'; import { createUntitledResource } from '@theia/plugin-ext/lib/main/browser/editor/untitled-resource'; @@ -317,7 +317,7 @@ export class PluginVscodeCommandsContribution implements CommandContribution { */ } - private getHtml(body: String) { + private getHtml(body: String): string { return `${body}`; } diff --git a/packages/plugin-ext-vscode/src/node/plugin-vscode-init.ts b/packages/plugin-ext-vscode/src/node/plugin-vscode-init.ts index 7002c624dcc93..9b074d03eee07 100644 --- a/packages/plugin-ext-vscode/src/node/plugin-vscode-init.ts +++ b/packages/plugin-ext-vscode/src/node/plugin-vscode-init.ts @@ -54,7 +54,7 @@ export const doInitialization: BackendInitializationFn = (apiFactory: PluginAPIF const panel = createWebviewPanel(viewType, title, showOptions, options); // redefine property Object.defineProperty(panel.webview, 'html', { - set: function (html: string) { + set: function (html: string): void { const newHtml = html.replace(new RegExp('vscode-resource:/', 'g'), 'webview/'); this.checkIsDisposed(); if (this._html !== newHtml) { @@ -109,7 +109,7 @@ function overrideInternalLoad(): void { // if we try to resolve theia module, return the filename entry to use cache. // tslint:disable-next-line:no-any - module._load = function (request: string, parent: any, isMain: {}) { + module._load = function (request: string, parent: any, isMain: {}): any { if (request !== vscodeModuleName) { return internalLoad.apply(this, arguments); } diff --git a/packages/plugin-ext/src/common/assert.ts b/packages/plugin-ext/src/common/assert.ts index 64ab8fa506dbe..5f151ee0ad0e2 100644 --- a/packages/plugin-ext/src/common/assert.ts +++ b/packages/plugin-ext/src/common/assert.ts @@ -16,7 +16,7 @@ ********************************************************************************/ // tslint:disable-next-line:no-any -export function ok(val?: any, message?: string) { +export function ok(val?: any, message?: string): void { if (!val || val === null) { throw new Error(message ? `Assertion failed (${message})` : 'Assertion failed'); } diff --git a/packages/plugin-ext/src/api/async-util.ts b/packages/plugin-ext/src/common/async-util.ts similarity index 100% rename from packages/plugin-ext/src/api/async-util.ts rename to packages/plugin-ext/src/common/async-util.ts diff --git a/packages/plugin-ext/src/common/glob.ts b/packages/plugin-ext/src/common/glob.ts index a7538b2ac4ac7..2692da08e002e 100644 --- a/packages/plugin-ext/src/common/glob.ts +++ b/packages/plugin-ext/src/common/glob.ts @@ -294,7 +294,7 @@ interface ParsedExpressionPattern { const CACHE = new Map(); // new LRUCache(10000); // bounded to 10000 elements -const FALSE = function () { +const FALSE = function (): boolean { return false; }; @@ -329,7 +329,7 @@ function parsePattern(arg1: string | IRelativePattern, options: IGlobOptions): P let match: RegExpExecArray; if (T1.test(pattern)) { // common pattern: **/*.txt just need endsWith check const base = pattern.substr(4); // '**/*'.length === 4 - parsedPattern = function (path, basename) { + parsedPattern = function (path, basename): string { return path && strings.endsWith(path, base) ? pattern : null!; }; } else if (match = T2.exec(trimForExclusions(pattern, options))!) { // common pattern: **/some.txt just need basename check @@ -359,7 +359,7 @@ function wrapRelativePattern(parsedPattern: ParsedStringPattern, arg2: string | return parsedPattern; } - return function (path, basename) { + return function (path, basename): string | Promise { if (!paths.isEqualOrParent(path, arg2.base)) { return null!; } @@ -376,7 +376,7 @@ function trimForExclusions(pattern: string, options: IGlobOptions): string { function trivia2(base: string, originalPattern: string): ParsedStringPattern { const slashBase = `/${base}`; const backslashBase = `\\${base}`; - const parsedPattern: ParsedStringPattern = function (path, basename) { + const parsedPattern: ParsedStringPattern = function (path, basename): string { if (!path) { return null!; } @@ -404,7 +404,7 @@ function trivia3(pattern: string, options: IGlobOptions): ParsedStringPattern { if (n === 1) { return parsedPatterns[0]; } - const parsedPattern: ParsedStringPattern = function (path: string, basename: string) { + const parsedPattern: ParsedStringPattern = function (path: string, basename: string): string { for (let i = 0, n = parsedPatterns.length; i < n; i++) { if ((parsedPatterns[i])(path, basename)) { return pattern; @@ -429,10 +429,10 @@ function trivia4and5(path: string, pattern: string, matchPathEnds: boolean): Par const nativePath = paths.nativeSep !== paths.sep ? path.replace(ALL_FORWARD_SLASHES, paths.nativeSep) : path; const nativePathEnd = paths.nativeSep + nativePath; // tslint:disable-next-line:no-shadowed-variable - const parsedPattern: ParsedStringPattern = matchPathEnds ? function (path, basename) { + const parsedPattern: ParsedStringPattern = matchPathEnds ? function (path, basename): string { return path && (path === nativePath || strings.endsWith(path, nativePathEnd)) ? pattern : null!; // tslint:disable-next-line:no-shadowed-variable - } : function (path, basename) { + } : function (path, basename): string { return path && path === nativePath ? pattern : null!; }; parsedPattern.allPaths = [(matchPathEnds ? '*/' : './') + path]; @@ -442,7 +442,7 @@ function trivia4and5(path: string, pattern: string, matchPathEnds: boolean): Par function toRegExp(pattern: string): ParsedStringPattern { try { const regExp = new RegExp(`^${parseRegExp(pattern)}$`); - return function (path: string, basename: string) { + return function (path: string, basename: string): string { regExp.lastIndex = 0; // reset RegExp to its initial state to reuse it! return path && regExp.test(path) ? pattern : null!; }; @@ -492,7 +492,7 @@ export function parse(arg1: string | IExpression | IRelativePattern, options: IG if (parsedPattern === NULL) { return FALSE; } - const resultPattern = function (path: string, basename: string) { + const resultPattern = function (path: string, basename: string): boolean { return !!parsedPattern(path, basename); }; if (parsedPattern.allBasenames) { @@ -510,7 +510,7 @@ export function parse(arg1: string | IExpression | IRelativePattern, options: IG return parsedExpression(arg1, options); } -export function hasSiblingPromiseFn(siblingsFn?: () => Promise) { +export function hasSiblingPromiseFn(siblingsFn?: () => Promise): ((name: string) => Promise) | undefined { if (!siblingsFn) { return undefined; } @@ -525,7 +525,7 @@ export function hasSiblingPromiseFn(siblingsFn?: () => Promise) { }; } -export function hasSiblingFn(siblingsFn?: () => string[]) { +export function hasSiblingFn(siblingsFn?: () => string[]): ((name: string) => boolean) | undefined { if (!siblingsFn) { return undefined; } @@ -540,7 +540,7 @@ export function hasSiblingFn(siblingsFn?: () => string[]) { }; } -function listToMap(list: string[]) { +function listToMap(list: string[]): Record { const map: Record = {}; for (const key of list) { map[key] = true; @@ -591,7 +591,7 @@ function parsedExpression(expression: IExpression, options: IGlobOptions): Parse } // tslint:disable-next-line:no-shadowed-variable - const resultExpression: ParsedStringPattern = function (path: string, basename: string) { + const resultExpression: ParsedStringPattern = function (path: string, basename: string): string | Promise { // tslint:disable-next-line:no-shadowed-variable // tslint:disable-next-line:one-variable-per-declaration for (let i = 0, n = parsedPatterns.length; i < n; i++) { @@ -620,7 +620,7 @@ function parsedExpression(expression: IExpression, options: IGlobOptions): Parse return resultExpression; } - const resultExpression: ParsedStringPattern = function (path: string, basename: string, hasSibling?: (name: string) => boolean | Promise) { + const resultExpression: ParsedStringPattern = function (path: string, basename: string, hasSibling?: (name: string) => boolean | Promise): string | Promise { let name: string = null!; // tslint:disable-next-line:no-shadowed-variable @@ -714,7 +714,7 @@ function aggregateBasenameMatches(parsedPatterns: (ParsedStringPattern | ParsedE } else { patterns = basenamePatterns.reduce((all, current) => all.concat((current).patterns!), []); } - const aggregate: ParsedStringPattern = function (path, basename) { + const aggregate: ParsedStringPattern = function (path, basename): string { if (!path) { return null!; } diff --git a/packages/plugin-ext/src/common/index.ts b/packages/plugin-ext/src/common/index.ts index e433357f0f950..34c0ec9f50ce6 100644 --- a/packages/plugin-ext/src/common/index.ts +++ b/packages/plugin-ext/src/common/index.ts @@ -14,9 +14,9 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -// Here we expose types from @theia/plugin, so it becames a direct dependency +// Here we expose types from @theia/plugin, so it becomes a direct dependency export * from '../common/plugin-protocol'; export * from '../plugin/plugin-context'; -export * from '../api/plugin-api'; +export * from './plugin-api-rpc'; export * from '../main/node/temp-dir-util'; export * from './plugin-ext-api-contribution'; diff --git a/packages/plugin-ext/src/api/model.ts b/packages/plugin-ext/src/common/plugin-api-rpc-model.ts similarity index 99% rename from packages/plugin-ext/src/api/model.ts rename to packages/plugin-ext/src/common/plugin-api-rpc-model.ts index 6525281b7dfac..4938d87486706 100644 --- a/packages/plugin-ext/src/api/model.ts +++ b/packages/plugin-ext/src/common/plugin-api-rpc-model.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import * as theia from '@theia/plugin'; -import { UriComponents } from '../common/uri-components'; +import { UriComponents } from './uri-components'; import { FileStat } from '@theia/filesystem/lib/common'; import { SymbolInformation } from 'vscode-languageserver-types'; diff --git a/packages/plugin-ext/src/api/plugin-api.ts b/packages/plugin-ext/src/common/plugin-api-rpc.ts similarity index 98% rename from packages/plugin-ext/src/api/plugin-api.ts rename to packages/plugin-ext/src/common/plugin-api-rpc.ts index 6d52c3e2a12e6..dcaf80683839c 100644 --- a/packages/plugin-ext/src/api/plugin-api.ts +++ b/packages/plugin-ext/src/common/plugin-api-rpc.ts @@ -16,12 +16,11 @@ /* tslint:disable:no-any */ -import { Plugin as InternalPlugin } from '../api/plugin-api'; import { createProxyIdentifier, ProxyIdentifier } from './rpc-protocol'; import * as theia from '@theia/plugin'; -import { PluginLifecycle, PluginModel, PluginMetadata, PluginPackage, IconUrl } from '../common/plugin-protocol'; -import { QueryParameters } from '../common/env'; -import { TextEditorCursorStyle } from '../common/editor-options'; +import { PluginLifecycle, PluginModel, PluginMetadata, PluginPackage, IconUrl } from './plugin-protocol'; +import { QueryParameters } from './env'; +import { TextEditorCursorStyle } from './editor-options'; import { TextEditorLineNumbersStyle, EndOfLine, @@ -30,7 +29,7 @@ import { FileOperationOptions, QuickInputButton } from '../plugin/types-impl'; -import { UriComponents } from '../common/uri-components'; +import { UriComponents } from './uri-components'; import { ConfigurationTarget } from '../plugin/types-impl'; import { SerializedDocumentFilter, @@ -63,9 +62,9 @@ import { RenameLocation, FileMoveEvent, FileWillMoveEvent -} from './model'; -import { ExtPluginApi } from '../common/plugin-ext-api-contribution'; -import { KeysToAnyValues, KeysToKeysToAnyValue } from '../common/types'; +} from './plugin-api-rpc-model'; +import { ExtPluginApi } from './plugin-ext-api-contribution'; +import { KeysToAnyValues, KeysToKeysToAnyValue } from './types'; import { CancellationToken, Progress, ProgressOptions } from '@theia/plugin'; import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema'; import { DebuggerDescription } from '@theia/debug/lib/common/debug-service'; @@ -555,8 +554,8 @@ export namespace ScmCommandArg { } export interface ScmExt { - createSourceControl(plugin: InternalPlugin, id: string, label: string, rootUri?: theia.Uri): theia.SourceControl; - getLastInputBox(plugin: InternalPlugin): theia.SourceControlInputBox | undefined; + createSourceControl(plugin: Plugin, id: string, label: string, rootUri?: theia.Uri): theia.SourceControl; + getLastInputBox(plugin: Plugin): theia.SourceControlInputBox | undefined; $updateInputBox(sourceControlHandle: number, message: string): Promise; $executeResourceCommand(sourceControlHandle: number, groupHandle: number, resourceHandle: number): Promise; $provideOriginalResource(sourceControlHandle: number, uri: string, token: CancellationToken): Promise; diff --git a/packages/plugin-ext/src/common/plugin-ext-api-contribution.ts b/packages/plugin-ext/src/common/plugin-ext-api-contribution.ts index bf1c8a7616333..98f33b4ed3b4d 100644 --- a/packages/plugin-ext/src/common/plugin-ext-api-contribution.ts +++ b/packages/plugin-ext/src/common/plugin-ext-api-contribution.ts @@ -13,8 +13,8 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { RPCProtocol } from '../api/rpc-protocol'; -import { PluginManager, Plugin } from '../api/plugin-api'; +import { RPCProtocol } from './rpc-protocol'; +import { PluginManager, Plugin } from './plugin-api-rpc'; import { interfaces } from 'inversify'; export const ExtPluginApiProvider = 'extPluginApi'; diff --git a/packages/plugin-ext/src/common/plugin-message-writer.ts b/packages/plugin-ext/src/common/plugin-message-writer.ts index 8394d0ea8aa75..997e112ec6888 100644 --- a/packages/plugin-ext/src/common/plugin-message-writer.ts +++ b/packages/plugin-ext/src/common/plugin-message-writer.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { AbstractMessageWriter, MessageWriter } from 'vscode-jsonrpc/lib/messageWriter'; -import { ConnectionMain, ConnectionExt } from '../api/plugin-api'; +import { ConnectionMain, ConnectionExt } from './plugin-api-rpc'; import { Message } from 'vscode-jsonrpc'; /** diff --git a/packages/plugin-ext/src/common/plugin-protocol.ts b/packages/plugin-ext/src/common/plugin-protocol.ts index 0794ee0590fd1..2c322e127f830 100644 --- a/packages/plugin-ext/src/common/plugin-protocol.ts +++ b/packages/plugin-ext/src/common/plugin-protocol.ts @@ -14,10 +14,10 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ import { JsonRpcServer } from '@theia/core/lib/common/messaging/proxy-factory'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { RPCProtocol } from './rpc-protocol'; import { Disposable } from '@theia/core/lib/common/disposable'; import { LogPart, KeysToAnyValues, KeysToKeysToAnyValue } from './types'; -import { CharacterPair, CommentRule, PluginAPIFactory, Plugin } from '../api/plugin-api'; +import { CharacterPair, CommentRule, PluginAPIFactory, Plugin } from './plugin-api-rpc'; import { ExtPluginApi } from './plugin-ext-api-contribution'; import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema'; import { RecursivePartial } from '@theia/core/lib/common/types'; diff --git a/packages/plugin-ext/src/api/rpc-protocol.ts b/packages/plugin-ext/src/common/rpc-protocol.ts similarity index 100% rename from packages/plugin-ext/src/api/rpc-protocol.ts rename to packages/plugin-ext/src/common/rpc-protocol.ts diff --git a/packages/plugin-ext/src/hosted/browser/hosted-plugin.ts b/packages/plugin-ext/src/hosted/browser/hosted-plugin.ts index c1a3e2b7079df..076a1a667eb87 100644 --- a/packages/plugin-ext/src/hosted/browser/hosted-plugin.ts +++ b/packages/plugin-ext/src/hosted/browser/hosted-plugin.ts @@ -25,8 +25,9 @@ import { injectable, inject, interfaces, named, postConstruct } from 'inversify' import { PluginWorker } from '../../main/browser/plugin-worker'; import { HostedPluginServer, PluginMetadata, getPluginId } from '../../common/plugin-protocol'; import { HostedPluginWatcher } from './hosted-plugin-watcher'; +import { MAIN_RPC_CONTEXT, PluginManagerExt } from '../../common/plugin-api-rpc'; import { setUpPluginApi } from '../../main/browser/main-context'; -import { RPCProtocol, RPCProtocolImpl } from '../../api/rpc-protocol'; +import { RPCProtocol, RPCProtocolImpl } from '../../common/rpc-protocol'; import { ILogger, ContributionProvider, CommandRegistry, WillExecuteCommandEvent, CancellationTokenSource } from '@theia/core'; import { PreferenceServiceImpl, PreferenceProviderProvider } from '@theia/core/lib/browser'; import { WorkspaceService } from '@theia/workspace/lib/browser'; @@ -39,7 +40,6 @@ import { getPreferences } from '../../main/browser/preference-registry-main'; import { PluginServer } from '../../common/plugin-protocol'; import { KeysToKeysToAnyValue } from '../../common/types'; import { FileStat } from '@theia/filesystem/lib/common/filesystem'; -import { PluginManagerExt, MAIN_RPC_CONTEXT } from '../../common'; import { MonacoTextmateService } from '@theia/monaco/lib/browser/textmate'; import { Deferred } from '@theia/core/lib/common/promise-util'; import { DebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager'; diff --git a/packages/plugin-ext/src/hosted/browser/worker/debug-stub.ts b/packages/plugin-ext/src/hosted/browser/worker/debug-stub.ts index 3bf349a9b2355..97511c08d4756 100644 --- a/packages/plugin-ext/src/hosted/browser/worker/debug-stub.ts +++ b/packages/plugin-ext/src/hosted/browser/worker/debug-stub.ts @@ -15,12 +15,12 @@ ********************************************************************************/ import { DebugExtImpl } from '../../../plugin/node/debug/debug'; -import { RPCProtocol } from '../../../api/rpc-protocol'; +import { RPCProtocol } from '../../../common/rpc-protocol'; // tslint:disable:no-any export function createDebugExtStub(rpc: RPCProtocol): DebugExtImpl { return new Proxy(new DebugExtImpl(rpc), { - apply: function (target, that, args) { + apply: function (target, that, args): void { console.error('Debug API works only in plugin container'); } }); diff --git a/packages/plugin-ext/src/hosted/browser/worker/worker-env-ext.ts b/packages/plugin-ext/src/hosted/browser/worker/worker-env-ext.ts index e667f32a38176..c3a7db41900df 100644 --- a/packages/plugin-ext/src/hosted/browser/worker/worker-env-ext.ts +++ b/packages/plugin-ext/src/hosted/browser/worker/worker-env-ext.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { EnvExtImpl } from '../../../plugin/env'; -import { RPCProtocol } from '../../../api/rpc-protocol'; +import { RPCProtocol } from '../../../common/rpc-protocol'; /** * Worker specific implementation not returning any FileSystem details diff --git a/packages/plugin-ext/src/hosted/browser/worker/worker-main.ts b/packages/plugin-ext/src/hosted/browser/worker/worker-main.ts index d11ef144db951..6a4f1ef131a99 100644 --- a/packages/plugin-ext/src/hosted/browser/worker/worker-main.ts +++ b/packages/plugin-ext/src/hosted/browser/worker/worker-main.ts @@ -15,9 +15,9 @@ ********************************************************************************/ import { Emitter } from '@theia/core/lib/common/event'; -import { RPCProtocolImpl } from '../../../api/rpc-protocol'; +import { RPCProtocolImpl } from '../../../common/rpc-protocol'; import { PluginManagerExtImpl } from '../../../plugin/plugin-manager'; -import { MAIN_RPC_CONTEXT, Plugin, emptyPlugin } from '../../../api/plugin-api'; +import { MAIN_RPC_CONTEXT, Plugin, emptyPlugin } from '../../../common/plugin-api-rpc'; import { createAPIFactory } from '../../../plugin/plugin-context'; import { getPluginId, PluginMetadata } from '../../../common/plugin-protocol'; import * as theia from '@theia/plugin'; @@ -110,7 +110,7 @@ const pluginManager = new PluginManagerExtImpl({ return [result, foreign]; }, - initExtApi(extApi: ExtPluginApi[]) { + initExtApi(extApi: ExtPluginApi[]): void { for (const api of extApi) { try { if (api.frontendExtApi) { @@ -161,7 +161,7 @@ rpc.set(MAIN_RPC_CONTEXT.EDITORS_AND_DOCUMENTS_EXT, editorsAndDocuments); rpc.set(MAIN_RPC_CONTEXT.WORKSPACE_EXT, workspaceExt); rpc.set(MAIN_RPC_CONTEXT.PREFERENCE_REGISTRY_EXT, preferenceRegistryExt); -function isElectron() { +function isElectron(): boolean { if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) { return true; } diff --git a/packages/plugin-ext/src/hosted/node/hosted-plugin-process.ts b/packages/plugin-ext/src/hosted/node/hosted-plugin-process.ts index 0978c2de35b27..25b7be5d9428e 100644 --- a/packages/plugin-ext/src/hosted/node/hosted-plugin-process.ts +++ b/packages/plugin-ext/src/hosted/node/hosted-plugin-process.ts @@ -21,8 +21,8 @@ import { ILogger, ConnectionErrorHandler, ContributionProvider, MessageService } import { Emitter } from '@theia/core/lib/common/event'; import { createIpcEnv } from '@theia/core/lib/node/messaging/ipc-protocol'; import { HostedPluginClient, ServerPluginRunner, PluginMetadata, PluginHostEnvironmentVariable } from '../../common/plugin-protocol'; -import { RPCProtocolImpl } from '../../api/rpc-protocol'; -import { MAIN_RPC_CONTEXT } from '../../api/plugin-api'; +import { RPCProtocolImpl } from '../../common/rpc-protocol'; +import { MAIN_RPC_CONTEXT } from '../../common/plugin-api-rpc'; import { HostedPluginCliContribution } from './hosted-plugin-cli-contribution'; import { HostedPluginProcessesCache } from './hosted-plugin-processes-cache'; import * as psTree from 'ps-tree'; @@ -99,7 +99,7 @@ export class HostedPluginProcess implements ServerPluginRunner { } } - public markPluginServerTerminated() { + public markPluginServerTerminated(): void { if (this.childProcess) { this.pluginProcessCache.scheduleChildProcessTermination(this, this.childProcess); } @@ -157,7 +157,7 @@ export class HostedPluginProcess implements ServerPluginRunner { } - private linkClientWithChildProcess(childProcess: cp.ChildProcess) { + private linkClientWithChildProcess(childProcess: cp.ChildProcess): void { childProcess.on('message', message => { if (this.client) { this.client.postMessage(message); diff --git a/packages/plugin-ext/src/hosted/node/hosted-plugin-processes-cache.ts b/packages/plugin-ext/src/hosted/node/hosted-plugin-processes-cache.ts index 41760a4556107..7045fdd6b9733 100644 --- a/packages/plugin-ext/src/hosted/node/hosted-plugin-processes-cache.ts +++ b/packages/plugin-ext/src/hosted/node/hosted-plugin-processes-cache.ts @@ -43,7 +43,7 @@ export class HostedPluginProcessesCache { return clientId; } - public linkLiveClientAndProcess(clientId: number, childProcess: cp.ChildProcess) { + public linkLiveClientAndProcess(clientId: number, childProcess: cp.ChildProcess): void { this.cachedCPMap.set(clientId, { cp: childProcess, toBeKilledAfter: Infinity @@ -55,7 +55,7 @@ export class HostedPluginProcessesCache { return childProcessDatum && childProcessDatum.cp; } - public scheduleChildProcessTermination(hostedPluginProcess: HostedPluginProcess, childProcess: cp.ChildProcess) { + public scheduleChildProcessTermination(hostedPluginProcess: HostedPluginProcess, childProcess: cp.ChildProcess): void { for (const cachedChildProcessesDatum of this.cachedCPMap.values()) { if (cachedChildProcessesDatum.cp === childProcess) { cachedChildProcessesDatum.toBeKilledAfter = new Date().getTime() + this.minKeepAliveDisconnectTime; diff --git a/packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts b/packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts index 411a8c3799435..ad49960d2e1f4 100644 --- a/packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts +++ b/packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { PluginManagerExtImpl } from '../../plugin/plugin-manager'; -import { MAIN_RPC_CONTEXT, Plugin, PluginAPIFactory } from '../../api/plugin-api'; +import { MAIN_RPC_CONTEXT, Plugin, PluginAPIFactory } from '../../common/plugin-api-rpc'; import { PluginMetadata } from '../../common/plugin-protocol'; import { createAPIFactory } from '../../plugin/plugin-context'; import { EnvExtImpl } from '../../plugin/env'; @@ -40,7 +40,7 @@ export class PluginHostRPC { constructor(protected readonly rpc: any) { } - initialize() { + initialize(): void { const envExt = new EnvNodeExtImpl(this.rpc); const debugExt = new DebugExtImpl(this.rpc); const editorsAndDocumentsExt = new EditorsAndDocumentsExtImpl(this.rpc); @@ -96,7 +96,7 @@ export class PluginHostRPC { console.log('PLUGIN_HOST(' + process.pid + '): PluginManagerExtImpl/loadPlugin(' + plugin.pluginPath + ')'); try { // cleaning the cache for all files of that plug-in. - Object.keys(require.cache).forEach(function (key) { + Object.keys(require.cache).forEach(function (key): void { const mod: NodeJS.Module = require.cache[key]; // attempting to reload a native module will throw an error, so skip them @@ -173,7 +173,7 @@ export class PluginHostRPC { } return [result, foreign]; }, - initExtApi(extApi: ExtPluginApi[]) { + initExtApi(extApi: ExtPluginApi[]): void { for (const api of extApi) { if (api.backendInitPath) { try { diff --git a/packages/plugin-ext/src/hosted/node/plugin-host.ts b/packages/plugin-ext/src/hosted/node/plugin-host.ts index e0761ccd1d815..588a22977c498 100644 --- a/packages/plugin-ext/src/hosted/node/plugin-host.ts +++ b/packages/plugin-ext/src/hosted/node/plugin-host.ts @@ -15,12 +15,12 @@ ********************************************************************************/ import { Emitter } from '@theia/core/lib/common/event'; -import { RPCProtocolImpl } from '../../api/rpc-protocol'; +import { RPCProtocolImpl } from '../../common/rpc-protocol'; import { PluginHostRPC } from './plugin-host-rpc'; console.log('PLUGIN_HOST(' + process.pid + ') starting instance'); // override exit() function, to do not allow plugin kill this node -process.exit = function (code?: number) { +process.exit = function (code?: number): void { const err = new Error('An plugin call process.exit() and it was prevented.'); console.warn(err.stack); } as (code?: number) => never; @@ -29,7 +29,7 @@ process.exit = function (code?: number) { // tslint:disable-next-line: no-any const proc = process as any; if (proc.crash) { - proc.crash = function () { + proc.crash = function (): void { const err = new Error('An plugin call process.crash() and it was prevented.'); console.warn(err.stack); }; diff --git a/packages/plugin-ext/src/hosted/node/plugin-reader.ts b/packages/plugin-ext/src/hosted/node/plugin-reader.ts index 4dc30dd0d86dd..48584da15a2e0 100644 --- a/packages/plugin-ext/src/hosted/node/plugin-reader.ts +++ b/packages/plugin-ext/src/hosted/node/plugin-reader.ts @@ -64,7 +64,7 @@ export class HostedPluginReader implements BackendApplicationContribution { /** * MUST never throw to isolate plugin deployment */ - async doGetPluginMetadata(pluginPath: string | undefined) { + async doGetPluginMetadata(pluginPath: string | undefined): Promise { try { if (!pluginPath) { return undefined; diff --git a/packages/plugin-ext/src/hosted/node/scanners/backend-init-theia.ts b/packages/plugin-ext/src/hosted/node/scanners/backend-init-theia.ts index 09772ce9bf37b..6c6dfaaf8f4d2 100644 --- a/packages/plugin-ext/src/hosted/node/scanners/backend-init-theia.ts +++ b/packages/plugin-ext/src/hosted/node/scanners/backend-init-theia.ts @@ -16,7 +16,7 @@ import * as theia from '@theia/plugin'; import { BackendInitializationFn } from '../../../common/plugin-protocol'; -import { PluginAPIFactory, Plugin, emptyPlugin } from '../../../api/plugin-api'; +import { PluginAPIFactory, Plugin, emptyPlugin } from '../../../common/plugin-api-rpc'; const pluginsApiImpl = new Map(); const plugins = new Array(); @@ -46,7 +46,7 @@ function overrideInternalLoad(): void { // if we try to resolve theia module, return the filename entry to use cache. // tslint:disable-next-line:no-any - module._load = function (request: string, parent: any, isMain: {}) { + module._load = function (request: string, parent: any, isMain: {}): any { if (request !== '@theia/plugin') { return internalLoad.apply(this, arguments); } diff --git a/packages/plugin-ext/src/hosted/node/scanners/scanner-theia.ts b/packages/plugin-ext/src/hosted/node/scanners/scanner-theia.ts index b1804d73bef5b..af4e6e94f3458 100644 --- a/packages/plugin-ext/src/hosted/node/scanners/scanner-theia.ts +++ b/packages/plugin-ext/src/hosted/node/scanners/scanner-theia.ts @@ -49,7 +49,7 @@ import * as fs from 'fs'; import * as path from 'path'; import { isObject } from 'util'; import { GrammarsReader } from './grammars-reader'; -import { CharacterPair } from '../../../api/plugin-api'; +import { CharacterPair } from '../../../common/plugin-api-rpc'; import * as jsoncparser from 'jsonc-parser'; import { IJSONSchema } from '@theia/core/lib/common/json-schema'; import { deepClone } from '@theia/core/lib/common/objects'; @@ -59,7 +59,7 @@ import { RecursivePartial } from '@theia/core/lib/common/types'; import { ProblemMatcherContribution, ProblemPatternContribution, TaskDefinition } from '@theia/task/lib/common/task-protocol'; namespace nls { - export function localize(key: string, _default: string) { + export function localize(key: string, _default: string): string { return _default; } } diff --git a/packages/plugin-ext/src/main/browser/command-registry-main.ts b/packages/plugin-ext/src/main/browser/command-registry-main.ts index cbaa6416f6fc4..cac05348dcbdd 100644 --- a/packages/plugin-ext/src/main/browser/command-registry-main.ts +++ b/packages/plugin-ext/src/main/browser/command-registry-main.ts @@ -18,8 +18,8 @@ import { interfaces } from 'inversify'; import { CommandRegistry } from '@theia/core/lib/common/command'; import * as theia from '@theia/plugin'; import { Disposable } from '@theia/core/lib/common/disposable'; -import { CommandRegistryMain, CommandRegistryExt, MAIN_RPC_CONTEXT } from '../../api/plugin-api'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { CommandRegistryMain, CommandRegistryExt, MAIN_RPC_CONTEXT } from '../../common/plugin-api-rpc'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { KeybindingRegistry } from '@theia/core/lib/browser'; import { PluginContributionHandler } from './plugin-contribution-handler'; diff --git a/packages/plugin-ext/src/main/browser/connection-main.ts b/packages/plugin-ext/src/main/browser/connection-main.ts index 5dd543bfda4b5..9ef6aa1ce8521 100644 --- a/packages/plugin-ext/src/main/browser/connection-main.ts +++ b/packages/plugin-ext/src/main/browser/connection-main.ts @@ -14,8 +14,8 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { MAIN_RPC_CONTEXT, ConnectionMain, ConnectionExt } from '../../api/plugin-api'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { MAIN_RPC_CONTEXT, ConnectionMain, ConnectionExt } from '../../common/plugin-api-rpc'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { PluginConnection } from '../../common/connection'; import { PluginMessageReader } from '../../common/plugin-message-reader'; import { PluginMessageWriter } from '../../common/plugin-message-writer'; diff --git a/packages/plugin-ext/src/main/browser/debug/debug-main.ts b/packages/plugin-ext/src/main/browser/debug/debug-main.ts index 28354195ba493..a00a0e57f4e30 100644 --- a/packages/plugin-ext/src/main/browser/debug/debug-main.ts +++ b/packages/plugin-ext/src/main/browser/debug/debug-main.ts @@ -17,14 +17,14 @@ // tslint:disable:no-any import { interfaces } from 'inversify'; -import { RPCProtocol } from '../../../api/rpc-protocol'; +import { RPCProtocol } from '../../../common/rpc-protocol'; import { DebugMain, DebugExt, MAIN_RPC_CONTEXT -} from '../../../api/plugin-api'; +} from '../../../common/plugin-api-rpc'; import { DebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager'; -import { Breakpoint, WorkspaceFolder } from '../../../api/model'; +import { Breakpoint, WorkspaceFolder } from '../../../common/plugin-api-rpc-model'; import { LabelProvider } from '@theia/core/lib/browser'; import { EditorManager } from '@theia/editor/lib/browser'; import { BreakpointManager } from '@theia/debug/lib/browser/breakpoint/breakpoint-manager'; diff --git a/packages/plugin-ext/src/main/browser/debug/plugin-debug-adapter-contribution.ts b/packages/plugin-ext/src/main/browser/debug/plugin-debug-adapter-contribution.ts index 20e3566e085fc..d37d41893db80 100644 --- a/packages/plugin-ext/src/main/browser/debug/plugin-debug-adapter-contribution.ts +++ b/packages/plugin-ext/src/main/browser/debug/plugin-debug-adapter-contribution.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { DebugExt, } from '../../../api/plugin-api'; +import { DebugExt, } from '../../../common/plugin-api-rpc'; import { DebugConfiguration } from '@theia/debug/lib/common/debug-configuration'; import { IJSONSchemaSnippet, IJSONSchema } from '@theia/core/lib/common/json-schema'; import { MaybePromise } from '@theia/core/lib/common/types'; diff --git a/packages/plugin-ext/src/main/browser/debug/plugin-debug-session-factory.ts b/packages/plugin-ext/src/main/browser/debug/plugin-debug-session-factory.ts index 3ea8661d5b2d5..ebb919456c7c2 100644 --- a/packages/plugin-ext/src/main/browser/debug/plugin-debug-session-factory.ts +++ b/packages/plugin-ext/src/main/browser/debug/plugin-debug-session-factory.ts @@ -29,7 +29,7 @@ import { IWebSocket } from 'vscode-ws-jsonrpc/lib/socket/socket'; import { FileSystem } from '@theia/filesystem/lib/common'; import { DebugProtocol } from 'vscode-debugprotocol'; import { TerminalWidgetOptions } from '@theia/terminal/lib/browser/base/terminal-widget'; -import { TerminalOptionsExt } from '../../../api/plugin-api'; +import { TerminalOptionsExt } from '../../../common/plugin-api-rpc'; export class PluginDebugSession extends DebugSession { constructor( diff --git a/packages/plugin-ext/src/main/browser/decorations/decorations-main.ts b/packages/plugin-ext/src/main/browser/decorations/decorations-main.ts index 6198e6eda0aae..596c5b8afc20b 100644 --- a/packages/plugin-ext/src/main/browser/decorations/decorations-main.ts +++ b/packages/plugin-ext/src/main/browser/decorations/decorations-main.ts @@ -19,12 +19,12 @@ import { DecorationsExt, DecorationsMain, MAIN_RPC_CONTEXT -} from '../../../api/plugin-api'; +} from '../../../common/plugin-api-rpc'; import { interfaces } from 'inversify'; import { Emitter } from '@theia/core'; import { Tree, TreeDecoration } from '@theia/core/lib/browser'; -import { RPCProtocol } from '../../../api/rpc-protocol'; +import { RPCProtocol } from '../../../common/rpc-protocol'; import { ScmDecorationsService } from '@theia/scm/lib/browser/decorations/scm-decorations-service'; export class DecorationsMainImpl implements DecorationsMain { diff --git a/packages/plugin-ext/src/main/browser/dialogs-main.ts b/packages/plugin-ext/src/main/browser/dialogs-main.ts index d86ada69b4a3c..167d58f592986 100644 --- a/packages/plugin-ext/src/main/browser/dialogs-main.ts +++ b/packages/plugin-ext/src/main/browser/dialogs-main.ts @@ -15,8 +15,8 @@ ********************************************************************************/ import { interfaces } from 'inversify'; -import { RPCProtocol } from '../../api/rpc-protocol'; -import { OpenDialogOptionsMain, SaveDialogOptionsMain, DialogsMain } from '../../api/plugin-api'; +import { RPCProtocol } from '../../common/rpc-protocol'; +import { OpenDialogOptionsMain, SaveDialogOptionsMain, DialogsMain } from '../../common/plugin-api-rpc'; import URI from '@theia/core/lib/common/uri'; import { DirNode, OpenFileDialogProps, SaveFileDialogProps, OpenFileDialogFactory, SaveFileDialogFactory } from '@theia/filesystem/lib/browser'; import { WorkspaceService } from '@theia/workspace/lib/browser'; diff --git a/packages/plugin-ext/src/main/browser/documents-main.ts b/packages/plugin-ext/src/main/browser/documents-main.ts index 94c066e778b7c..858a275a1095a 100644 --- a/packages/plugin-ext/src/main/browser/documents-main.ts +++ b/packages/plugin-ext/src/main/browser/documents-main.ts @@ -13,19 +13,19 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { DocumentsMain, MAIN_RPC_CONTEXT, DocumentsExt } from '../../api/plugin-api'; +import { DocumentsMain, MAIN_RPC_CONTEXT, DocumentsExt } from '../../common/plugin-api-rpc'; import { UriComponents } from '../../common/uri-components'; import { EditorsAndDocumentsMain } from './editors-and-documents-main'; import { DisposableCollection, Disposable } from '@theia/core'; import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { EditorModelService } from './text-editor-model-service'; import { createUntitledResource } from './editor/untitled-resource'; import { EditorManager, EditorOpenerOptions } from '@theia/editor/lib/browser'; import URI from '@theia/core/lib/common/uri'; import CodeURI from 'vscode-uri'; import { ApplicationShell, Saveable } from '@theia/core/lib/browser'; -import { TextDocumentShowOptions } from '../../api/model'; +import { TextDocumentShowOptions } from '../../common/plugin-api-rpc-model'; import { Range } from 'vscode-languageserver-types'; import { OpenerService } from '@theia/core/lib/browser/opener-service'; import { Reference } from '@theia/core/lib/common/reference'; diff --git a/packages/plugin-ext/src/main/browser/editors-and-documents-main.ts b/packages/plugin-ext/src/main/browser/editors-and-documents-main.ts index b9643e212f0ec..df5dc96425a24 100644 --- a/packages/plugin-ext/src/main/browser/editors-and-documents-main.ts +++ b/packages/plugin-ext/src/main/browser/editors-and-documents-main.ts @@ -15,9 +15,17 @@ ********************************************************************************/ import { interfaces } from 'inversify'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { TextEditorService } from './text-editor-service'; -import { MAIN_RPC_CONTEXT, EditorsAndDocumentsExt, EditorsAndDocumentsDelta, ModelAddedData, TextEditorAddData, EditorPosition, PLUGIN_RPC_CONTEXT } from '../../api/plugin-api'; +import { + MAIN_RPC_CONTEXT, + EditorsAndDocumentsExt, + EditorsAndDocumentsDelta, + ModelAddedData, + TextEditorAddData, + EditorPosition, + PLUGIN_RPC_CONTEXT +} from '../../common/plugin-api-rpc'; import { Disposable } from '@theia/core/lib/common/disposable'; import { EditorModelService } from './text-editor-model-service'; import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model'; diff --git a/packages/plugin-ext/src/main/browser/env-main.ts b/packages/plugin-ext/src/main/browser/env-main.ts index a1c16c7ee7fa8..55fd26eafcba2 100644 --- a/packages/plugin-ext/src/main/browser/env-main.ts +++ b/packages/plugin-ext/src/main/browser/env-main.ts @@ -16,8 +16,8 @@ import { interfaces } from 'inversify'; import { EnvVariablesServer } from '@theia/core/lib/common/env-variables'; -import { RPCProtocol } from '../../api/rpc-protocol'; -import { EnvMain } from '../../api/plugin-api'; +import { RPCProtocol } from '../../common/rpc-protocol'; +import { EnvMain } from '../../common/plugin-api-rpc'; import { QueryParameters } from '../../common/env'; import { isWindows, isOSX } from '@theia/core'; import { OperatingSystem } from '../../plugin/types-impl'; diff --git a/packages/plugin-ext/src/main/browser/file-system-main.ts b/packages/plugin-ext/src/main/browser/file-system-main.ts index a181a03dc3a63..cabd4b5f28e15 100644 --- a/packages/plugin-ext/src/main/browser/file-system-main.ts +++ b/packages/plugin-ext/src/main/browser/file-system-main.ts @@ -19,8 +19,8 @@ import Uri from 'vscode-uri'; import { Disposable, ResourceResolver, DisposableCollection } from '@theia/core'; import { Resource } from '@theia/core/lib/common/resource'; import URI from '@theia/core/lib/common/uri'; -import { MAIN_RPC_CONTEXT, FileSystemMain, FileSystemExt } from '../../api/plugin-api'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { MAIN_RPC_CONTEXT, FileSystemMain, FileSystemExt } from '../../common/plugin-api-rpc'; +import { RPCProtocol } from '../../common/rpc-protocol'; export class FileSystemMainImpl implements FileSystemMain, Disposable { @@ -119,5 +119,5 @@ export class FSResource implements Resource { return this.proxy.$writeFile(this.handle, Uri.parse(this.uri.toString()), content, options); } - dispose() { } + dispose(): void { } } diff --git a/packages/plugin-ext/src/main/browser/in-plugin-filesystem-watcher-manager.ts b/packages/plugin-ext/src/main/browser/in-plugin-filesystem-watcher-manager.ts index e9ab774dcddee..0e897735300e9 100644 --- a/packages/plugin-ext/src/main/browser/in-plugin-filesystem-watcher-manager.ts +++ b/packages/plugin-ext/src/main/browser/in-plugin-filesystem-watcher-manager.ts @@ -16,8 +16,8 @@ import { interfaces } from 'inversify'; import { FileSystemWatcher, FileChangeEvent, FileChangeType, FileChange, FileMoveEvent, FileWillMoveEvent } from '@theia/filesystem/lib/browser/filesystem-watcher'; -import { WorkspaceExt } from '../../api/plugin-api'; -import { FileWatcherSubscriberOptions } from '../../api/model'; +import { WorkspaceExt } from '../../common/plugin-api-rpc'; +import { FileWatcherSubscriberOptions } from '../../common/plugin-api-rpc-model'; import { parse, ParsedPattern, IRelativePattern } from '../../common/glob'; import { RelativePattern } from '../../plugin/types-impl'; import { theiaUritoUriComponents } from '../../common/uri-components'; diff --git a/packages/plugin-ext/src/main/browser/keybindings/keybindings-contribution-handler.ts b/packages/plugin-ext/src/main/browser/keybindings/keybindings-contribution-handler.ts index c4ac1b7f78f6b..b8d9f707de875 100644 --- a/packages/plugin-ext/src/main/browser/keybindings/keybindings-contribution-handler.ts +++ b/packages/plugin-ext/src/main/browser/keybindings/keybindings-contribution-handler.ts @@ -73,7 +73,7 @@ export class KeybindingsContributionPointHandler { return keybinding || pluginKeybinding.keybinding; } - private handlePartialKeybindings(keybinding: Keybinding, partialKeybindings: Keybinding[]) { + private handlePartialKeybindings(keybinding: Keybinding, partialKeybindings: Keybinding[]): void { partialKeybindings.forEach(partial => { if (keybinding.context === undefined || keybinding.context === partial.context) { this.logger.warn(`Partial keybinding is ignored; ${Keybinding.stringify(keybinding)} shadows ${Keybinding.stringify(partial)}`); @@ -81,7 +81,7 @@ export class KeybindingsContributionPointHandler { }); } - private handleShadingKeybindings(keybinding: Keybinding, shadingKeybindings: Keybinding[]) { + private handleShadingKeybindings(keybinding: Keybinding, shadingKeybindings: Keybinding[]): void { shadingKeybindings.forEach(shadow => { if (shadow.context === undefined || shadow.context === keybinding.context) { this.keybindingRegistry.unregisterKeybinding(shadow); diff --git a/packages/plugin-ext/src/main/browser/language-provider/language-client-contribution-provider-impl.ts b/packages/plugin-ext/src/main/browser/language-provider/language-client-contribution-provider-impl.ts index 9bf1af45ad13e..8827d18fa4b8e 100644 --- a/packages/plugin-ext/src/main/browser/language-provider/language-client-contribution-provider-impl.ts +++ b/packages/plugin-ext/src/main/browser/language-provider/language-client-contribution-provider-impl.ts @@ -34,7 +34,7 @@ export class LanguageClientContributionProviderImpl implements LanguageClientCon protected readonly languageClientContributors = new Map(); @postConstruct() - collectContributions() { + collectContributions(): void { for (const contribution of this.contributions.getContributions()) { this.languageClientContributors.set(contribution.id, contribution); } diff --git a/packages/plugin-ext/src/main/browser/languages-contribution-main.ts b/packages/plugin-ext/src/main/browser/languages-contribution-main.ts index 301e0102bdec8..b50fe3b7e57ad 100644 --- a/packages/plugin-ext/src/main/browser/languages-contribution-main.ts +++ b/packages/plugin-ext/src/main/browser/languages-contribution-main.ts @@ -17,8 +17,8 @@ import { interfaces } from 'inversify'; import { LanguagesContributionMain, MAIN_RPC_CONTEXT -} from '../../api/plugin-api'; -import { RPCProtocol } from '../../api/rpc-protocol'; +} from '../../common/plugin-api-rpc'; +import { RPCProtocol } from '../../common/rpc-protocol'; import * as theia from '@theia/plugin'; import { Workspace, Languages, MessageReader, MessageWriter } from '@theia/languages/lib/browser/language-client-services'; import { LanguageClientFactory, BaseLanguageClientContribution } from '@theia/languages/lib/browser'; @@ -108,11 +108,11 @@ class PluginLanguageClientContribution extends BaseLanguageClientContribution { super(workspace, languages, languageClientFactory); } - protected get globPatterns() { + protected get globPatterns(): string[] { return this.patterns ? this.patterns : []; } - protected get workspaceContains() { + protected get workspaceContains(): string[] { return this.contains ? this.contains : []; } diff --git a/packages/plugin-ext/src/main/browser/languages-main.ts b/packages/plugin-ext/src/main/browser/languages-main.ts index 5241b99c9e41b..6fc0e487cb800 100644 --- a/packages/plugin-ext/src/main/browser/languages-main.ts +++ b/packages/plugin-ext/src/main/browser/languages-main.ts @@ -33,10 +33,10 @@ import { WorkspaceEditDto, ResourceTextEditDto, ResourceFileEditDto, -} from '../../api/plugin-api'; +} from '../../common/plugin-api-rpc'; import { interfaces } from 'inversify'; -import { SerializedDocumentFilter, MarkerData, Range, WorkspaceSymbolProvider, RelatedInformation, MarkerSeverity } from '../../api/model'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { SerializedDocumentFilter, MarkerData, Range, WorkspaceSymbolProvider, RelatedInformation, MarkerSeverity } from '../../common/plugin-api-rpc-model'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { fromLanguageSelector } from '../../plugin/type-converters'; import { LanguageSelector } from '../../plugin/languages'; import { DocumentFilter, MonacoModelIdentifier, testGlob, getLanguages } from 'monaco-languageclient/lib'; diff --git a/packages/plugin-ext/src/main/browser/main-context.ts b/packages/plugin-ext/src/main/browser/main-context.ts index 60c0b8cc7ec49..ad5746e27fd69 100644 --- a/packages/plugin-ext/src/main/browser/main-context.ts +++ b/packages/plugin-ext/src/main/browser/main-context.ts @@ -17,8 +17,8 @@ import { interfaces } from 'inversify'; import { CommandRegistryMainImpl } from './command-registry-main'; import { PreferenceRegistryMainImpl } from './preference-registry-main'; import { QuickOpenMainImpl } from './quick-open-main'; -import { RPCProtocol } from '../../api/rpc-protocol'; -import { PLUGIN_RPC_CONTEXT } from '../../api/plugin-api'; +import { RPCProtocol } from '../../common/rpc-protocol'; +import { PLUGIN_RPC_CONTEXT } from '../../common/plugin-api-rpc'; import { MessageRegistryMainImpl } from './message-registry-main'; import { WindowStateMain } from './window-state-main'; import { WorkspaceMainImpl } from './workspace-main'; diff --git a/packages/plugin-ext/src/main/browser/menus/menus-contribution-handler.spec.ts b/packages/plugin-ext/src/main/browser/menus/menus-contribution-handler.spec.ts index f5dce51b0d27c..ef60dcbaabf12 100644 --- a/packages/plugin-ext/src/main/browser/menus/menus-contribution-handler.spec.ts +++ b/packages/plugin-ext/src/main/browser/menus/menus-contribution-handler.spec.ts @@ -93,7 +93,7 @@ describe.skip('MenusContributionHandler', () => { registerCmdHandlerSpy = sinon.spy(commandRegistry, 'registerHandler'); }); - afterEach(function () { + afterEach(function (): void { notificationWarnSpy.restore(); registerMenuSpy.restore(); registerCmdHandlerSpy.restore(); @@ -172,7 +172,7 @@ describe.skip('MenusContributionHandler', () => { sinon.assert.called(loggerWarnSpy); }); - function assertItemIsRegistered(menuPath: MenuPath, menuGroup: string = '', order?: string) { + function assertItemIsRegistered(menuPath: MenuPath, menuGroup: string = '', order?: string): void { sinon.assert.calledWithExactly(registerMenuSpy, [...menuPath, menuGroup], { diff --git a/packages/plugin-ext/src/main/browser/message-registry-main.ts b/packages/plugin-ext/src/main/browser/message-registry-main.ts index 44f8356956a49..74062a512b328 100644 --- a/packages/plugin-ext/src/main/browser/message-registry-main.ts +++ b/packages/plugin-ext/src/main/browser/message-registry-main.ts @@ -16,7 +16,7 @@ import { interfaces } from 'inversify'; import { MessageService } from '@theia/core/lib/common/message-service'; -import { MessageRegistryMain, MainMessageType, MainMessageOptions } from '../../api/plugin-api'; +import { MessageRegistryMain, MainMessageType, MainMessageOptions } from '../../common/plugin-api-rpc'; import { ModalNotification, MessageType } from './dialogs/modal-notification'; export class MessageRegistryMainImpl implements MessageRegistryMain { diff --git a/packages/plugin-ext/src/main/browser/notification-main.ts b/packages/plugin-ext/src/main/browser/notification-main.ts index 9105931786309..a3c518be0fae0 100644 --- a/packages/plugin-ext/src/main/browser/notification-main.ts +++ b/packages/plugin-ext/src/main/browser/notification-main.ts @@ -14,10 +14,10 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { MAIN_RPC_CONTEXT, NotificationExt, NotificationMain } from '../../api/plugin-api'; +import { MAIN_RPC_CONTEXT, NotificationExt, NotificationMain } from '../../common/plugin-api-rpc'; import { MessageService, Progress } from '@theia/core/lib/common'; import { interfaces } from 'inversify'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { Deferred } from '@theia/core/lib/common/promise-util'; export class NotificationMainImpl implements NotificationMain { diff --git a/packages/plugin-ext/src/main/browser/output-channel-registry-main.ts b/packages/plugin-ext/src/main/browser/output-channel-registry-main.ts index a6daf5897e9f9..a1eaae17969f7 100644 --- a/packages/plugin-ext/src/main/browser/output-channel-registry-main.ts +++ b/packages/plugin-ext/src/main/browser/output-channel-registry-main.ts @@ -18,7 +18,7 @@ import { interfaces } from 'inversify'; import { OutputWidget } from '@theia/output/lib/browser/output-widget'; import { OutputContribution } from '@theia/output/lib/browser/output-contribution'; import { OutputChannel, OutputChannelManager } from '@theia/output/lib/common/output-channel'; -import { OutputChannelRegistryMain } from '../../api/plugin-api'; +import { OutputChannelRegistryMain } from '../../common/plugin-api-rpc'; export class OutputChannelRegistryMainImpl implements OutputChannelRegistryMain { private outputChannelManager: OutputChannelManager; diff --git a/packages/plugin-ext/src/main/browser/plugin-contribution-handler.ts b/packages/plugin-ext/src/main/browser/plugin-contribution-handler.ts index d81cca1ba4fa5..dc208ada89cfb 100644 --- a/packages/plugin-ext/src/main/browser/plugin-contribution-handler.ts +++ b/packages/plugin-ext/src/main/browser/plugin-contribution-handler.ts @@ -16,7 +16,7 @@ import { injectable, inject } from 'inversify'; import { ITokenTypeMap, IEmbeddedLanguagesMap, StandardTokenType } from 'vscode-textmate'; -import { TextmateRegistry, getEncodedLanguageId, MonacoTextmateService } from '@theia/monaco/lib/browser/textmate'; +import { TextmateRegistry, getEncodedLanguageId, MonacoTextmateService, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { MenusContributionPointHandler } from './menus/menus-contribution-handler'; import { PluginViewRegistry } from './view/plugin-view-registry'; import { PluginContribution, IndentationRules, FoldingRules, ScopeMap } from '../../common'; @@ -128,7 +128,7 @@ export class PluginContributionHandler { } this.grammarsRegistry.registerTextmateGrammarScope(grammar.scope, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: grammar.format, content: grammar.grammar || '', @@ -223,9 +223,9 @@ export class PluginContributionHandler { return handler(...args); }, // Always enabled - a command can be executed programmatically or via the commands palette. - isEnabled() { return true; }, + isEnabled(): boolean { return true; }, // Visibility rules are defined via the `menus` contribution point. - isVisible() { return true; } + isVisible(): boolean { return true; } })); this.commandHandlers.set(command.id, undefined); toDispose.push(Disposable.create(() => this.commandHandlers.delete(command.id))); diff --git a/packages/plugin-ext/src/main/browser/plugin-ext-widget.tsx b/packages/plugin-ext/src/main/browser/plugin-ext-widget.tsx index 06b098ce31b2c..58f4f2c96f09e 100644 --- a/packages/plugin-ext/src/main/browser/plugin-ext-widget.tsx +++ b/packages/plugin-ext/src/main/browser/plugin-ext-widget.tsx @@ -98,7 +98,7 @@ export class PluginWidget extends ReactWidget { ; } - private renderPlugin(plugin: PluginMetadata) { + private renderPlugin(plugin: PluginMetadata): JSX.Element { return
diff --git a/packages/plugin-ext/src/main/browser/plugin-storage.ts b/packages/plugin-ext/src/main/browser/plugin-storage.ts index 427d808f66519..4c757cd85443c 100644 --- a/packages/plugin-ext/src/main/browser/plugin-storage.ts +++ b/packages/plugin-ext/src/main/browser/plugin-storage.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { interfaces } from 'inversify'; -import { StorageMain } from '../../api/plugin-api'; +import { StorageMain } from '../../common/plugin-api-rpc'; import { PluginServer } from '../../common/plugin-protocol'; import { KeysToAnyValues, KeysToKeysToAnyValue } from '../../common/types'; diff --git a/packages/plugin-ext/src/main/browser/plugin-worker.ts b/packages/plugin-ext/src/main/browser/plugin-worker.ts index e42b96eb369a7..e277a174d99c3 100644 --- a/packages/plugin-ext/src/main/browser/plugin-worker.ts +++ b/packages/plugin-ext/src/main/browser/plugin-worker.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { injectable } from 'inversify'; import { Emitter } from '@theia/core/lib/common/event'; -import { RPCProtocol, RPCProtocolImpl } from '../../api/rpc-protocol'; +import { RPCProtocol, RPCProtocolImpl } from '../../common/rpc-protocol'; @injectable() export class PluginWorker { diff --git a/packages/plugin-ext/src/main/browser/preference-registry-main.ts b/packages/plugin-ext/src/main/browser/preference-registry-main.ts index 02dd3b676fc08..d3dbb622c6a8d 100644 --- a/packages/plugin-ext/src/main/browser/preference-registry-main.ts +++ b/packages/plugin-ext/src/main/browser/preference-registry-main.ts @@ -27,8 +27,8 @@ import { PreferenceRegistryMain, PreferenceData, PreferenceChangeExt, -} from '../../api/plugin-api'; -import { RPCProtocol } from '../../api/rpc-protocol'; +} from '../../common/plugin-api-rpc'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { ConfigurationTarget } from '../../plugin/types-impl'; import { WorkspaceService } from '@theia/workspace/lib/browser'; import { FileStat } from '@theia/filesystem/lib/common/filesystem'; diff --git a/packages/plugin-ext/src/main/browser/quick-open-main.ts b/packages/plugin-ext/src/main/browser/quick-open-main.ts index a15d2d1a021b2..8c10c50e99ced 100644 --- a/packages/plugin-ext/src/main/browser/quick-open-main.ts +++ b/packages/plugin-ext/src/main/browser/quick-open-main.ts @@ -16,14 +16,18 @@ import { InputBoxOptions, QuickPickItem as QuickPickItemExt } from '@theia/plugin'; import { interfaces } from 'inversify'; +import { QuickOpenModel, QuickOpenItem, QuickOpenMode, QuickOpenItemOptions } from '@theia/core/lib/browser/quick-open/quick-open-model'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { - QuickOpenModel, - QuickOpenItem, - QuickOpenMode, - QuickOpenItemOptions -} from '@theia/core/lib/browser/quick-open/quick-open-model'; -import { RPCProtocol } from '../../api/rpc-protocol'; -import { QuickOpenExt, QuickOpenMain, MAIN_RPC_CONTEXT, PickOptions, PickOpenItem, TransferInputBox, QuickInputTitleButtonHandle, TransferQuickPick } from '../../api/plugin-api'; + QuickOpenExt, + QuickOpenMain, + MAIN_RPC_CONTEXT, + PickOptions, + PickOpenItem, + TransferInputBox, + QuickInputTitleButtonHandle, + TransferQuickPick +} from '../../common/plugin-api-rpc'; import { MonacoQuickOpenService } from '@theia/monaco/lib/browser/monaco-quick-open-service'; import { QuickInputService, FOLDER_ICON, FILE_ICON } from '@theia/core/lib/browser'; import { PluginSharedStyle } from './plugin-shared-style'; @@ -58,7 +62,7 @@ export class QuickOpenMainImpl implements QuickOpenMain, QuickOpenModel { this.sharedStyle = container.get(PluginSharedStyle); } - private cleanUp() { + private cleanUp(): void { this.items = undefined; this.acceptor = undefined; if (this.activeElement) { diff --git a/packages/plugin-ext/src/main/browser/scm-main.ts b/packages/plugin-ext/src/main/browser/scm-main.ts index 037698aa13ea8..2e4bbc525a548 100644 --- a/packages/plugin-ext/src/main/browser/scm-main.ts +++ b/packages/plugin-ext/src/main/browser/scm-main.ts @@ -21,11 +21,11 @@ import { ScmMain, SourceControlProviderFeatures, SourceControlResourceState -} from '../../api/plugin-api'; +} from '../../common/plugin-api-rpc'; import { ScmProvider, ScmResource, ScmResourceDecorations, ScmResourceGroup, ScmCommand } from '@theia/scm/lib/browser/scm-provider'; import { ScmRepository } from '@theia/scm/lib/browser/scm-repository'; import { ScmService } from '@theia/scm/lib/browser/scm-service'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { interfaces } from 'inversify'; import { CancellationToken, DisposableCollection, Emitter, Event } from '@theia/core'; import URI from '@theia/core/lib/common/uri'; @@ -300,7 +300,7 @@ export class PluginScmResourceGroup implements ScmResourceGroup { ) { } - get resources() { + get resources(): PluginScmResource[] { return this._resources; } @@ -316,7 +316,7 @@ export class PluginScmResourceGroup implements ScmResourceGroup { this.label = label; } - updateResources(resources: PluginScmResource[]) { + updateResources(resources: PluginScmResource[]): void { this._resources = resources; } diff --git a/packages/plugin-ext/src/main/browser/status-bar-message-registry-main.ts b/packages/plugin-ext/src/main/browser/status-bar-message-registry-main.ts index 421d2eb8ebe7b..1838d7ee23e8e 100644 --- a/packages/plugin-ext/src/main/browser/status-bar-message-registry-main.ts +++ b/packages/plugin-ext/src/main/browser/status-bar-message-registry-main.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { interfaces } from 'inversify'; import * as types from '../../plugin/types-impl'; -import { StatusBarMessageRegistryMain } from '../../api/plugin-api'; +import { StatusBarMessageRegistryMain } from '../../common/plugin-api-rpc'; import { StatusBar, StatusBarAlignment, StatusBarEntry } from '@theia/core/lib/browser/status-bar/status-bar'; export class StatusBarMessageRegistryMainImpl implements StatusBarMessageRegistryMain { diff --git a/packages/plugin-ext/src/main/browser/tasks-main.ts b/packages/plugin-ext/src/main/browser/tasks-main.ts index 1dfad329f127b..9fc376b3b1f8c 100644 --- a/packages/plugin-ext/src/main/browser/tasks-main.ts +++ b/packages/plugin-ext/src/main/browser/tasks-main.ts @@ -18,13 +18,13 @@ import { TasksMain, MAIN_RPC_CONTEXT, TasksExt -} from '../../api/plugin-api'; -import { RPCProtocol } from '../../api/rpc-protocol'; +} from '../../common/plugin-api-rpc'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { DisposableCollection } from '@theia/core'; import { TaskProviderRegistry, TaskResolverRegistry, TaskProvider, TaskResolver } from '@theia/task/lib/browser/task-contribution'; import { interfaces } from 'inversify'; import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service'; -import { TaskInfo, TaskExitedEvent } from '@theia/task/lib/common/task-protocol'; +import { TaskInfo, TaskExitedEvent, TaskConfiguration } from '@theia/task/lib/common/task-protocol'; import { TaskWatcher } from '@theia/task/lib/common/task-watcher'; import { TaskService } from '@theia/task/lib/browser/task-service'; @@ -103,7 +103,10 @@ export class TasksMainImpl implements TasksMain { } } - async $taskExecutions() { + async $taskExecutions(): Promise<{ + id: number; + task: TaskConfiguration; + }[]> { const runningTasks = await this.taskService.getRunningTasks(); return runningTasks.map(taskInfo => ({ id: taskInfo.taskId, diff --git a/packages/plugin-ext/src/main/browser/terminal-main.ts b/packages/plugin-ext/src/main/browser/terminal-main.ts index 62927a5d9ece1..54f7bf3f47d0e 100644 --- a/packages/plugin-ext/src/main/browser/terminal-main.ts +++ b/packages/plugin-ext/src/main/browser/terminal-main.ts @@ -19,8 +19,8 @@ import { ApplicationShell, WidgetOpenerOptions } from '@theia/core/lib/browser'; import { TerminalOptions } from '@theia/plugin'; import { TerminalWidget } from '@theia/terminal/lib/browser/base/terminal-widget'; import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service'; -import { TerminalServiceMain, TerminalServiceExt, MAIN_RPC_CONTEXT } from '../../api/plugin-api'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { TerminalServiceMain, TerminalServiceExt, MAIN_RPC_CONTEXT } from '../../common/plugin-api-rpc'; +import { RPCProtocol } from '../../common/rpc-protocol'; /** * Plugin api service allows working with terminal emulator. diff --git a/packages/plugin-ext/src/main/browser/text-editor-main.ts b/packages/plugin-ext/src/main/browser/text-editor-main.ts index 88ab4c53f955a..05da61af2114f 100644 --- a/packages/plugin-ext/src/main/browser/text-editor-main.ts +++ b/packages/plugin-ext/src/main/browser/text-editor-main.ts @@ -24,8 +24,8 @@ import { ApplyEditsOptions, UndoStopOptions, DecorationOptions -} from '../../api/plugin-api'; -import { Range } from '../../api/model'; +} from '../../common/plugin-api-rpc'; +import { Range } from '../../common/plugin-api-rpc-model'; import { DisposableCollection, Emitter, Event } from '@theia/core'; import { TextEditorCursorStyle, cursorStyleToString } from '../../common/editor-options'; import { TextEditorLineNumbersStyle, EndOfLine } from '../../plugin/types-impl'; diff --git a/packages/plugin-ext/src/main/browser/text-editor-service.ts b/packages/plugin-ext/src/main/browser/text-editor-service.ts index ab39fb9fc96a4..dc6c4a419282a 100644 --- a/packages/plugin-ext/src/main/browser/text-editor-service.ts +++ b/packages/plugin-ext/src/main/browser/text-editor-service.ts @@ -71,7 +71,7 @@ export class TextEditorServiceImpl implements TextEditorService { this.onTextEditorAddEmitter.fire(editor); } } - private onEditorRemoved(editor: MonacoEditor) { + private onEditorRemoved(editor: MonacoEditor): void { if (this.editors.has(editor.getControl().getId())) { this.editors.delete(editor.getControl().getId()); this.onTextEditorRemoveEmitter.fire(editor); diff --git a/packages/plugin-ext/src/main/browser/text-editors-main.ts b/packages/plugin-ext/src/main/browser/text-editors-main.ts index cb5bf90929d3b..1963d3baf3627 100644 --- a/packages/plugin-ext/src/main/browser/text-editors-main.ts +++ b/packages/plugin-ext/src/main/browser/text-editors-main.ts @@ -27,10 +27,10 @@ import { DecorationRenderOptions, DecorationOptions, WorkspaceEditDto -} from '../../api/plugin-api'; -import { Range } from '../../api/model'; +} from '../../common/plugin-api-rpc'; +import { Range } from '../../common/plugin-api-rpc-model'; import { EditorsAndDocumentsMain } from './editors-and-documents-main'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { DisposableCollection } from '@theia/core'; import { TextEditorMain } from './text-editor-main'; import { disposed } from '../../common/errors'; diff --git a/packages/plugin-ext/src/main/browser/view/tree-view-widget.tsx b/packages/plugin-ext/src/main/browser/view/tree-view-widget.tsx index 6a2fff281002b..8beaaf2784a6b 100644 --- a/packages/plugin-ext/src/main/browser/view/tree-view-widget.tsx +++ b/packages/plugin-ext/src/main/browser/view/tree-view-widget.tsx @@ -15,8 +15,8 @@ ********************************************************************************/ import { injectable, inject, postConstruct } from 'inversify'; -import { TreeViewsExt, TreeViewSelection } from '../../../api/plugin-api'; -import { Command } from '../../../api/model'; +import { TreeViewsExt, TreeViewSelection } from '../../../common/plugin-api-rpc'; +import { Command } from '../../../common/plugin-api-rpc-model'; import { TreeWidget, TreeNode, @@ -32,7 +32,7 @@ import { TREE_NODE_TAIL_CLASS, TreeModelImpl } from '@theia/core/lib/browser'; -import { TreeViewItem, TreeViewItemCollapsibleState } from '../../../api/plugin-api'; +import { TreeViewItem, TreeViewItemCollapsibleState } from '../../../common/plugin-api-rpc'; import { MenuPath, MenuModelRegistry, ActionMenuNode } from '@theia/core/lib/common/menu'; import * as React from 'react'; import { PluginSharedStyle } from '../plugin-shared-style'; diff --git a/packages/plugin-ext/src/main/browser/view/tree-views-main.ts b/packages/plugin-ext/src/main/browser/view/tree-views-main.ts index baf0b4db917f2..6c2738078208f 100644 --- a/packages/plugin-ext/src/main/browser/view/tree-views-main.ts +++ b/packages/plugin-ext/src/main/browser/view/tree-views-main.ts @@ -15,8 +15,8 @@ ********************************************************************************/ import { interfaces } from 'inversify'; -import { MAIN_RPC_CONTEXT, TreeViewsMain, TreeViewsExt } from '../../../api/plugin-api'; -import { RPCProtocol } from '../../../api/rpc-protocol'; +import { MAIN_RPC_CONTEXT, TreeViewsMain, TreeViewsExt } from '../../../common/plugin-api-rpc'; +import { RPCProtocol } from '../../../common/rpc-protocol'; import { PluginViewRegistry, PLUGIN_VIEW_DATA_FACTORY_ID } from './plugin-view-registry'; import { SelectableTreeNode, ExpandableTreeNode, CompositeTreeNode, WidgetManager } from '@theia/core/lib/browser'; import { ViewContextKeyService } from './view-context-key-service'; @@ -101,7 +101,7 @@ export class TreeViewsMainImpl implements TreeViewsMain { } } - protected handleTreeEvents(treeViewId: string, treeViewWidget: TreeViewWidget) { + protected handleTreeEvents(treeViewId: string, treeViewWidget: TreeViewWidget): void { treeViewWidget.model.onExpansionChanged(event => { this.proxy.$setExpanded(treeViewId, event.id, event.expanded); }); diff --git a/packages/plugin-ext/src/main/browser/webview/theme-rules-service.ts b/packages/plugin-ext/src/main/browser/webview/theme-rules-service.ts index 281649899cf85..1e2766a619a0e 100644 --- a/packages/plugin-ext/src/main/browser/webview/theme-rules-service.ts +++ b/packages/plugin-ext/src/main/browser/webview/theme-rules-service.ts @@ -103,7 +103,7 @@ export class ThemeRulesService { return true; } - setIconPath(webviewId: string, iconPath: IconPath | string | undefined) { + setIconPath(webviewId: string, iconPath: IconPath | string | undefined): void { if (!iconPath) { this.icons.delete(webviewId); } else { @@ -116,7 +116,7 @@ export class ThemeRulesService { this.updateIconStyleElement(); } - private updateIconStyleElement() { + private updateIconStyleElement(): void { if (!this.styleElement) { return; } diff --git a/packages/plugin-ext/src/main/browser/webview/webview.ts b/packages/plugin-ext/src/main/browser/webview/webview.ts index ef7dc6db15df5..067e721415dc1 100644 --- a/packages/plugin-ext/src/main/browser/webview/webview.ts +++ b/packages/plugin-ext/src/main/browser/webview/webview.ts @@ -71,7 +71,7 @@ export class WebviewWidget extends BaseWidget { })); } - protected handleMessage(message: any) { + protected handleMessage(message: any): void { switch (message.command) { case 'onmessage': this.eventDelegate.onMessage!(message.data); @@ -87,7 +87,7 @@ export class WebviewWidget extends BaseWidget { this.iframe.contentWindow!.postMessage(message, '*'); } - setOptions(options: WebviewWidgetOptions) { + setOptions(options: WebviewWidgetOptions): void { if (!this.iframe || this.options.allowScripts === options.allowScripts) { return; } @@ -96,11 +96,11 @@ export class WebviewWidget extends BaseWidget { this.reloadFrame(); } - setIconClass(iconClass: string) { + setIconClass(iconClass: string): void { this.title.iconClass = iconClass; } - setHTML(html: string) { + setHTML(html: string): void { const newDocument = new DOMParser().parseFromString(html, 'text/html'); if (!newDocument || !newDocument.body) { return; @@ -191,14 +191,14 @@ export class WebviewWidget extends BaseWidget { super.onBeforeHide(msg); } - public reloadFrame() { + public reloadFrame(): void { if (!this.iframe || !this.iframe.contentDocument || !this.iframe.contentDocument.documentElement) { return; } this.setHTML(this.iframe.contentDocument.documentElement.innerHTML); } - private updateSandboxAttribute(element: HTMLElement, isAllowScript?: boolean) { + private updateSandboxAttribute(element: HTMLElement, isAllowScript?: boolean): void { if (!element) { return; } @@ -206,7 +206,7 @@ export class WebviewWidget extends BaseWidget { element.setAttribute('sandbox', allowScripts ? 'allow-scripts allow-forms allow-same-origin' : 'allow-same-origin'); } - private updateApiScript(contentDocument: Document, isAllowScript?: boolean) { + private updateApiScript(contentDocument: Document, isAllowScript?: boolean): void { if (!contentDocument) { return; } @@ -286,7 +286,7 @@ export class WebviewWidget extends BaseWidget { /** * Check if given object is ready to receive message and if it is ready, resolve promise */ - waitReceiveMessage(object: WebviewWidget, resolve: any) { + waitReceiveMessage(object: WebviewWidget, resolve: any): void { if (object.readyToReceiveMessage) { resolve(true); } else { diff --git a/packages/plugin-ext/src/main/browser/webviews-main.ts b/packages/plugin-ext/src/main/browser/webviews-main.ts index 926c36532340c..6c3ba9983560f 100644 --- a/packages/plugin-ext/src/main/browser/webviews-main.ts +++ b/packages/plugin-ext/src/main/browser/webviews-main.ts @@ -14,9 +14,9 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { WebviewsMain, MAIN_RPC_CONTEXT, WebviewsExt } from '../../api/plugin-api'; +import { WebviewsMain, MAIN_RPC_CONTEXT, WebviewsExt } from '../../common/plugin-api-rpc'; import { interfaces } from 'inversify'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { UriComponents } from '../../common/uri-components'; import { WebviewOptions, WebviewPanelOptions, WebviewPanelShowOptions } from '@theia/plugin'; import { ApplicationShell } from '@theia/core/lib/browser/shell/application-shell'; @@ -116,7 +116,7 @@ export class WebviewsMainImpl implements WebviewsMain { this.viewsOptions.set(view.id, { panelOptions: showOptions, options: options, panelId, visible: false, active: false }); this.addOrReattachWidget(panelId, showOptions); } - private addOrReattachWidget(handler: string, showOptions: WebviewPanelShowOptions) { + private addOrReattachWidget(handler: string, showOptions: WebviewPanelShowOptions): void { const view = this.views.get(handler); if (!view) { return; @@ -237,7 +237,7 @@ export class WebviewsMainImpl implements WebviewsMain { this.revivers.delete(viewType); } - private async checkViewOptions(handler: string, viewColumn?: number | undefined) { + private async checkViewOptions(handler: string, viewColumn?: number | undefined): Promise { const options = this.viewsOptions.get(handler); if (!options || !options.panelOptions) { return; @@ -269,7 +269,7 @@ export class WebviewsMainImpl implements WebviewsMain { return webview; } - private onCloseView(viewId: string) { + private onCloseView(viewId: string): void { const view = this.views.get(viewId); if (view) { this.themeRulesService.setIconPath(view.id, undefined); diff --git a/packages/plugin-ext/src/main/browser/window-state-main.ts b/packages/plugin-ext/src/main/browser/window-state-main.ts index 4012fd6f31a47..02701eef60614 100644 --- a/packages/plugin-ext/src/main/browser/window-state-main.ts +++ b/packages/plugin-ext/src/main/browser/window-state-main.ts @@ -14,8 +14,8 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { WindowStateExt, MAIN_RPC_CONTEXT } from '../../api/plugin-api'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { WindowStateExt, MAIN_RPC_CONTEXT } from '../../common/plugin-api-rpc'; +import { RPCProtocol } from '../../common/rpc-protocol'; export class WindowStateMain { diff --git a/packages/plugin-ext/src/main/browser/workspace-main.ts b/packages/plugin-ext/src/main/browser/workspace-main.ts index 1deb006b344f0..2ff68008b20d5 100644 --- a/packages/plugin-ext/src/main/browser/workspace-main.ts +++ b/packages/plugin-ext/src/main/browser/workspace-main.ts @@ -16,8 +16,8 @@ import * as theia from '@theia/plugin'; import { interfaces, injectable } from 'inversify'; -import { WorkspaceExt, StorageExt, MAIN_RPC_CONTEXT, WorkspaceMain, WorkspaceFolderPickOptionsMain } from '../../api/plugin-api'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { WorkspaceExt, StorageExt, MAIN_RPC_CONTEXT, WorkspaceMain, WorkspaceFolderPickOptionsMain } from '../../common/plugin-api-rpc'; +import { RPCProtocol } from '../../common/rpc-protocol'; import Uri from 'vscode-uri'; import { UriComponents } from '../../common/uri-components'; import { QuickOpenModel, QuickOpenItem, QuickOpenMode } from '@theia/core/lib/browser/quick-open/quick-open-model'; @@ -28,7 +28,7 @@ import URI from '@theia/core/lib/common/uri'; import { WorkspaceService } from '@theia/workspace/lib/browser'; import { Resource } from '@theia/core/lib/common/resource'; import { Emitter, Event, Disposable, ResourceResolver } from '@theia/core'; -import { FileWatcherSubscriberOptions } from '../../api/model'; +import { FileWatcherSubscriberOptions } from '../../common/plugin-api-rpc-model'; import { InPluginFileSystemWatcherManager } from './in-plugin-filesystem-watcher-manager'; import { StoragePathService } from './storage-path-service'; import { PluginServer } from '../../common/plugin-protocol'; @@ -263,7 +263,7 @@ export class TextContentResourceResolver implements ResourceResolver { } resource = new TextContentResource(uri, proxy, { - dispose() { + dispose(): void { instance.resources.delete(uri.toString()); } }); @@ -315,11 +315,11 @@ export class TextContentResource implements Resource { return Promise.reject(new Error(`Unable to get content for '${this.uri.toString()}'`)); } - dispose() { + dispose(): void { this.disposable.dispose(); } - setContent(content: string) { + setContent(content: string): void { this.cache = content; this.onDidChangeContentsEmitter.fire(undefined); } diff --git a/packages/plugin-ext/src/main/node/plugin-deployer-contribution.ts b/packages/plugin-ext/src/main/node/plugin-deployer-contribution.ts index c4dff08788a80..cae9ed0363dd5 100644 --- a/packages/plugin-ext/src/main/node/plugin-deployer-contribution.ts +++ b/packages/plugin-ext/src/main/node/plugin-deployer-contribution.ts @@ -28,7 +28,7 @@ export class PluginDeployerContribution implements BackendApplicationContributio @inject(PluginDeployer) protected pluginDeployer: PluginDeployer; - initialize() { + initialize(): void { this.pluginDeployer.start(); } } diff --git a/packages/plugin-ext/src/main/node/plugin-deployer-entry-impl.ts b/packages/plugin-ext/src/main/node/plugin-deployer-entry-impl.ts index 42314c2a20f6b..9b2cf632f4a6f 100644 --- a/packages/plugin-ext/src/main/node/plugin-deployer-entry-impl.ts +++ b/packages/plugin-ext/src/main/node/plugin-deployer-entry-impl.ts @@ -100,7 +100,7 @@ export class PluginDeployerEntryImpl implements PluginDeployerEntry { return types.some(type => this.acceptedTypes.indexOf(type) >= 0); } - setResolvedBy(name: string) { + setResolvedBy(name: string): void { this.resolvedByName = name; } diff --git a/packages/plugin-ext/src/main/node/plugins-key-value-storage.ts b/packages/plugin-ext/src/main/node/plugins-key-value-storage.ts index 55dfbe475a54f..269c4e3fa6436 100644 --- a/packages/plugin-ext/src/main/node/plugins-key-value-storage.ts +++ b/packages/plugin-ext/src/main/node/plugins-key-value-storage.ts @@ -37,7 +37,7 @@ export class PluginsKeyValueStorage { this.setupDirectories(); } - private async setupDirectories() { + private async setupDirectories(): Promise { const theiaDirPath = await this.pluginPathsService.getTheiaDirPath(); await this.fileSystem.createFolder(theiaDirPath); this.theiaDirPath = theiaDirPath; diff --git a/packages/plugin-ext/src/plugin/command-registry.ts b/packages/plugin-ext/src/plugin/command-registry.ts index 7c6e7785d49dc..0fd1e386efb20 100644 --- a/packages/plugin-ext/src/plugin/command-registry.ts +++ b/packages/plugin-ext/src/plugin/command-registry.ts @@ -15,8 +15,8 @@ ********************************************************************************/ import * as theia from '@theia/plugin'; -import { CommandRegistryExt, PLUGIN_RPC_CONTEXT as Ext, CommandRegistryMain } from '../api/plugin-api'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { CommandRegistryExt, PLUGIN_RPC_CONTEXT as Ext, CommandRegistryMain } from '../common/plugin-api-rpc'; +import { RPCProtocol } from '../common/rpc-protocol'; import { Disposable } from './types-impl'; import { KnownCommands } from './type-converters'; diff --git a/packages/plugin-ext/src/plugin/connection-ext.ts b/packages/plugin-ext/src/plugin/connection-ext.ts index d285f74094bc4..d606cdb50e44d 100644 --- a/packages/plugin-ext/src/plugin/connection-ext.ts +++ b/packages/plugin-ext/src/plugin/connection-ext.ts @@ -14,8 +14,8 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { ConnectionExt, PLUGIN_RPC_CONTEXT, ConnectionMain } from '../api/plugin-api'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { ConnectionExt, PLUGIN_RPC_CONTEXT, ConnectionMain } from '../common/plugin-api-rpc'; +import { RPCProtocol } from '../common/rpc-protocol'; import { PluginConnection } from '../common/connection'; import { PluginMessageReader } from '../common/plugin-message-reader'; import { PluginMessageWriter } from '../common/plugin-message-writer'; diff --git a/packages/plugin-ext/src/plugin/decorations.ts b/packages/plugin-ext/src/plugin/decorations.ts index 4c114a13482a9..27da4686c5fa2 100644 --- a/packages/plugin-ext/src/plugin/decorations.ts +++ b/packages/plugin-ext/src/plugin/decorations.ts @@ -21,9 +21,9 @@ import { DecorationsExt, DecorationsMain, PLUGIN_RPC_CONTEXT -} from '../api/plugin-api'; +} from '../common/plugin-api-rpc'; import { Event } from '@theia/core/lib/common/event'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { RPCProtocol } from '../common/rpc-protocol'; import URI from 'vscode-uri'; import { Disposable } from './types-impl'; diff --git a/packages/plugin-ext/src/plugin/dialogs.ts b/packages/plugin-ext/src/plugin/dialogs.ts index 68ca3a406886d..fbfaeba948682 100644 --- a/packages/plugin-ext/src/plugin/dialogs.ts +++ b/packages/plugin-ext/src/plugin/dialogs.ts @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { PLUGIN_RPC_CONTEXT as Ext, OpenDialogOptionsMain, DialogsMain, SaveDialogOptionsMain } from '../api/plugin-api'; +import { PLUGIN_RPC_CONTEXT as Ext, OpenDialogOptionsMain, DialogsMain, SaveDialogOptionsMain } from '../common/plugin-api-rpc'; import { OpenDialogOptions, SaveDialogOptions } from '@theia/plugin'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { RPCProtocol } from '../common/rpc-protocol'; import Uri from 'vscode-uri'; export class DialogsExtImpl { diff --git a/packages/plugin-ext/src/plugin/document-data.ts b/packages/plugin-ext/src/plugin/document-data.ts index c5c2b3f988f36..bec13ce1b5798 100644 --- a/packages/plugin-ext/src/plugin/document-data.ts +++ b/packages/plugin-ext/src/plugin/document-data.ts @@ -15,8 +15,8 @@ ********************************************************************************/ import * as theia from '@theia/plugin'; -import { ModelChangedEvent, DocumentsMain } from '../api/plugin-api'; -import { Range as ARange } from '../api/model'; +import { ModelChangedEvent, DocumentsMain } from '../common/plugin-api-rpc'; +import { Range as ARange } from '../common/plugin-api-rpc-model'; import URI from 'vscode-uri'; import { ok } from '../common/assert'; import { Range, Position, EndOfLine } from './types-impl'; @@ -79,23 +79,23 @@ export class DocumentDataExt { if (!this._document) { const that = this; this._document = { - get uri() { return that.uri; }, - get fileName() { return that.uri.fsPath; }, - get isUntitled() { return that.uri.scheme === 'untitled'; }, - get languageId() { return that.languageId; }, - get version() { return that.versionId; }, - get isClosed() { return that.disposed; }, - get isDirty() { return that.dirty; }, - save() { return that.save(); }, - getText(range?) { return range ? that.getTextInRange(range) : that.getText(); }, - get eol() { return that.eol === '\n' ? EndOfLine.LF : EndOfLine.CRLF; }, - get lineCount() { return that.lines.length; }, - lineAt(lineOrPos: number | theia.Position) { return that.lineAt(lineOrPos); }, - offsetAt(pos) { return that.offsetAt(pos); }, - positionAt(offset) { return that.positionAt(offset); }, - validateRange(ran) { return that.validateRange(ran); }, - validatePosition(pos) { return that.validatePosition(pos); }, - getWordRangeAtPosition(pos, regexp?) { return that.getWordRangeAtPosition(pos, regexp); } + get uri(): theia.Uri { return that.uri; }, + get fileName(): string { return that.uri.fsPath; }, + get isUntitled(): boolean { return that.uri.scheme === 'untitled'; }, + get languageId(): string { return that.languageId; }, + get version(): number { return that.versionId; }, + get isClosed(): boolean { return that.disposed; }, + get isDirty(): boolean { return that.dirty; }, + save(): Promise { return that.save(); }, + getText(range?): string { return range ? that.getTextInRange(range) : that.getText(); }, + get eol(): theia.EndOfLine { return that.eol === '\n' ? EndOfLine.LF : EndOfLine.CRLF; }, + get lineCount(): number { return that.lines.length; }, + lineAt(lineOrPos: number | theia.Position): theia.TextLine { return that.lineAt(lineOrPos); }, + offsetAt(pos): number { return that.offsetAt(pos); }, + positionAt(offset): theia.Position { return that.positionAt(offset); }, + validateRange(ran): theia.Range { return that.validateRange(ran); }, + validatePosition(pos): theia.Position { return that.validatePosition(pos); }, + getWordRangeAtPosition(pos, regexp?): theia.Range | undefined { return that.getWordRangeAtPosition(pos, regexp); } }; } return Object.freeze(this._document); diff --git a/packages/plugin-ext/src/plugin/documents.ts b/packages/plugin-ext/src/plugin/documents.ts index 8a6389574376c..7eb590cfa12c9 100644 --- a/packages/plugin-ext/src/plugin/documents.ts +++ b/packages/plugin-ext/src/plugin/documents.ts @@ -20,17 +20,17 @@ /** * based on https://github.com/Microsoft/vscode/blob/bf9a27ec01f2ef82fc45f69e0c946c7d74a57d3e/src/vs/workbench/api/node/extHostDocumentSaveParticipant.ts */ -import { DocumentsExt, ModelChangedEvent, PLUGIN_RPC_CONTEXT, DocumentsMain, SingleEditOperation } from '../api/plugin-api'; +import { DocumentsExt, ModelChangedEvent, PLUGIN_RPC_CONTEXT, DocumentsMain, SingleEditOperation } from '../common/plugin-api-rpc'; import URI from 'vscode-uri'; import { UriComponents } from '../common/uri-components'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { RPCProtocol } from '../common/rpc-protocol'; import { Emitter, Event } from '@theia/core/lib/common/event'; import * as theia from '@theia/plugin'; import { DocumentDataExt, setWordDefinitionFor } from './document-data'; import { EditorsAndDocumentsExtImpl } from './editors-and-documents'; import * as Converter from './type-converters'; import { DisposableCollection } from '@theia/core/lib/common/disposable'; -import { Range, TextDocumentShowOptions } from '../api/model'; +import { Range, TextDocumentShowOptions } from '../common/plugin-api-rpc-model'; import { TextEdit } from './types-impl'; export class DocumentsExtImpl implements DocumentsExt { @@ -124,16 +124,16 @@ export class DocumentsExtImpl implements DocumentsExt { protected async fireTextDocumentWillSaveEvent({ document, reason, fireEvent, accept }: { - document: theia.TextDocument, - reason: theia.TextDocumentSaveReason, - fireEvent: (e: theia.TextDocumentWillSaveEvent) => any, - accept: (operation: SingleEditOperation) => void - }): Promise { + document: theia.TextDocument, + reason: theia.TextDocumentSaveReason, + fireEvent: (e: theia.TextDocumentWillSaveEvent) => any, + accept: (operation: SingleEditOperation) => void + }): Promise { const promises: PromiseLike[] = []; fireEvent(Object.freeze({ document, reason, - waitUntil(p: PromiseLike) { + waitUntil(p: PromiseLike): void { if (Object.isFrozen(promises)) { throw new Error('waitUntil can not be called async'); } diff --git a/packages/plugin-ext/src/plugin/editors-and-documents.ts b/packages/plugin-ext/src/plugin/editors-and-documents.ts index aae2e66459b9b..b92d3ad5aa1a7 100644 --- a/packages/plugin-ext/src/plugin/editors-and-documents.ts +++ b/packages/plugin-ext/src/plugin/editors-and-documents.ts @@ -14,9 +14,9 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { EditorsAndDocumentsExt, EditorsAndDocumentsDelta, PLUGIN_RPC_CONTEXT } from '../api/plugin-api'; +import { EditorsAndDocumentsExt, EditorsAndDocumentsDelta, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc'; import { TextEditorExt } from './text-editor'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { RPCProtocol } from '../common/rpc-protocol'; import { Emitter, Event } from '@theia/core/lib/common/event'; import { DocumentDataExt } from './document-data'; import { ok } from '../common/assert'; diff --git a/packages/plugin-ext/src/plugin/env.ts b/packages/plugin-ext/src/plugin/env.ts index 197fc778da852..107cac5ccab72 100644 --- a/packages/plugin-ext/src/plugin/env.ts +++ b/packages/plugin-ext/src/plugin/env.ts @@ -15,8 +15,8 @@ ********************************************************************************/ import * as theia from '@theia/plugin'; -import { RPCProtocol } from '../api/rpc-protocol'; -import { EnvMain, PLUGIN_RPC_CONTEXT } from '../api/plugin-api'; +import { RPCProtocol } from '../common/rpc-protocol'; +import { EnvMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc'; import { QueryParameters } from '../common/env'; import { v4 } from 'uuid'; diff --git a/packages/plugin-ext/src/plugin/file-system.ts b/packages/plugin-ext/src/plugin/file-system.ts index 77fce3023c553..d7c6bdcec82da 100644 --- a/packages/plugin-ext/src/plugin/file-system.ts +++ b/packages/plugin-ext/src/plugin/file-system.ts @@ -16,8 +16,8 @@ import URI from 'vscode-uri'; import * as theia from '@theia/plugin'; -import { PLUGIN_RPC_CONTEXT, FileSystemExt, FileSystemMain } from '../api/plugin-api'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { PLUGIN_RPC_CONTEXT, FileSystemExt, FileSystemMain } from '../common/plugin-api-rpc'; +import { RPCProtocol } from '../common/rpc-protocol'; import { UriComponents, Schemes } from '../common/uri-components'; import { Disposable } from './types-impl'; diff --git a/packages/plugin-ext/src/plugin/in-plugin-filesystem-watcher-proxy.ts b/packages/plugin-ext/src/plugin/in-plugin-filesystem-watcher-proxy.ts index 3bc2c49b9f20d..35203ff00360b 100644 --- a/packages/plugin-ext/src/plugin/in-plugin-filesystem-watcher-proxy.ts +++ b/packages/plugin-ext/src/plugin/in-plugin-filesystem-watcher-proxy.ts @@ -16,8 +16,8 @@ import * as theia from '@theia/plugin'; import { Emitter, Event } from '@theia/core/lib/common/event'; -import { WorkspaceMain } from '../api/plugin-api'; -import { FileWatcherSubscriberOptions, FileChangeEventType } from '../api/model'; +import { WorkspaceMain } from '../common/plugin-api-rpc'; +import { FileWatcherSubscriberOptions, FileChangeEventType } from '../common/plugin-api-rpc-model'; import URI from 'vscode-uri'; /** @@ -56,7 +56,7 @@ export class InPluginFileSystemWatcherProxy { return new FileSystemWatcher(subscriberPrivateData, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents); } - onFileSystemEvent(id: string, uri: URI, type: FileChangeEventType) { + onFileSystemEvent(id: string, uri: URI, type: FileChangeEventType): void { const perSubscriberEventEmitter: Emitter | undefined = this.subscribers.get(id); if (perSubscriberEventEmitter) { perSubscriberEventEmitter.fire({ uri, type }); diff --git a/packages/plugin-ext/src/plugin/languages-contribution-ext.ts b/packages/plugin-ext/src/plugin/languages-contribution-ext.ts index 847ffe43004d6..afba9e8f50cb0 100644 --- a/packages/plugin-ext/src/plugin/languages-contribution-ext.ts +++ b/packages/plugin-ext/src/plugin/languages-contribution-ext.ts @@ -18,8 +18,8 @@ import { PLUGIN_RPC_CONTEXT, LanguagesContributionExt, LanguagesContributionMain -} from '../api/plugin-api'; -import { RPCProtocol } from '../api/rpc-protocol'; +} from '../common/plugin-api-rpc'; +import { RPCProtocol } from '../common/rpc-protocol'; import * as theia from '@theia/plugin'; import { ConnectionExtImpl } from './connection-ext'; import { ChildProcess, spawn, SpawnOptions } from 'child_process'; diff --git a/packages/plugin-ext/src/plugin/languages.ts b/packages/plugin-ext/src/plugin/languages.ts index 154fbb91d5da2..42bc2b79487a5 100644 --- a/packages/plugin-ext/src/plugin/languages.ts +++ b/packages/plugin-ext/src/plugin/languages.ts @@ -26,8 +26,8 @@ import { Selection, RawColorInfo, WorkspaceEditDto, -} from '../api/plugin-api'; -import { RPCProtocol } from '../api/rpc-protocol'; +} from '../common/plugin-api-rpc'; +import { RPCProtocol } from '../common/rpc-protocol'; import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from './documents'; import { PluginModel } from '../common/plugin-protocol'; @@ -55,7 +55,7 @@ import { Location, ColorPresentation, RenameLocation, -} from '../api/model'; +} from '../common/plugin-api-rpc-model'; import { CompletionAdapter } from './languages/completion'; import { Diagnostics } from './languages/diagnostics'; import { SignatureHelpAdapter } from './languages/signature'; @@ -77,6 +77,7 @@ import { SymbolInformation } from 'vscode-languageserver-types'; import { FoldingProviderAdapter } from './languages/folding'; import { ColorProviderAdapter } from './languages/color'; import { RenameAdapter } from './languages/rename'; +import { Event } from '@theia/core/lib/common/event'; type Adapter = CompletionAdapter | SignatureHelpAdapter | @@ -113,7 +114,7 @@ export class LanguagesExtImpl implements LanguagesExt { this.diagnostics = new Diagnostics(rpc); } - get onDidChangeDiagnostics() { + get onDidChangeDiagnostics(): Event { return this.diagnostics.onDidChangeDiagnostics; } diff --git a/packages/plugin-ext/src/plugin/languages/code-action.ts b/packages/plugin-ext/src/plugin/languages/code-action.ts index 5b33e1bbec5a4..6e7722fa6d1ca 100644 --- a/packages/plugin-ext/src/plugin/languages/code-action.ts +++ b/packages/plugin-ext/src/plugin/languages/code-action.ts @@ -16,8 +16,8 @@ import * as theia from '@theia/plugin'; import URI from 'vscode-uri/lib/umd'; -import { Selection } from '../../api/plugin-api'; -import { Range } from '../../api/model'; +import { Selection } from '../../common/plugin-api-rpc'; +import { Range } from '../../common/plugin-api-rpc-model'; import * as Converter from '../type-converters'; import { DocumentsExtImpl } from '../documents'; import { Diagnostics } from './diagnostics'; diff --git a/packages/plugin-ext/src/plugin/languages/color.ts b/packages/plugin-ext/src/plugin/languages/color.ts index 8ab484f7f74a6..8151114a24ea3 100644 --- a/packages/plugin-ext/src/plugin/languages/color.ts +++ b/packages/plugin-ext/src/plugin/languages/color.ts @@ -18,8 +18,8 @@ import * as theia from '@theia/plugin'; import URI from 'vscode-uri/lib/umd'; import { DocumentsExtImpl } from '../documents'; import * as Converter from '../type-converters'; -import { RawColorInfo } from '../../api/plugin-api'; -import { ColorPresentation } from '../../api/model'; +import { RawColorInfo } from '../../common/plugin-api-rpc'; +import { ColorPresentation } from '../../common/plugin-api-rpc-model'; export class ColorProviderAdapter { diff --git a/packages/plugin-ext/src/plugin/languages/completion.ts b/packages/plugin-ext/src/plugin/languages/completion.ts index bfd631093d6b4..6f83655dfb250 100644 --- a/packages/plugin-ext/src/plugin/languages/completion.ts +++ b/packages/plugin-ext/src/plugin/languages/completion.ts @@ -20,8 +20,8 @@ import { CompletionList, Range, SnippetString } from '../types-impl'; import { DocumentsExtImpl } from '../documents'; import * as Converter from '../type-converters'; import { mixin } from '../../common/types'; -import { Position } from '../../api/plugin-api'; -import { CompletionContext, CompletionResultDto, Completion, CompletionDto } from '../../api/model'; +import { Position } from '../../common/plugin-api-rpc'; +import { CompletionContext, CompletionResultDto, Completion, CompletionDto } from '../../common/plugin-api-rpc-model'; export class CompletionAdapter { private cacheId = 0; @@ -102,7 +102,7 @@ export class CompletionAdapter { }); } - releaseCompletionItems(id: number) { + releaseCompletionItems(id: number): Promise { this.cache.delete(id); return Promise.resolve(); } diff --git a/packages/plugin-ext/src/plugin/languages/definition.ts b/packages/plugin-ext/src/plugin/languages/definition.ts index 87de22671fcb0..24440a0442944 100644 --- a/packages/plugin-ext/src/plugin/languages/definition.ts +++ b/packages/plugin-ext/src/plugin/languages/definition.ts @@ -19,8 +19,8 @@ import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from '../documents'; import * as types from '../types-impl'; import * as Converter from '../type-converters'; -import { Position } from '../../api/plugin-api'; -import { Definition, DefinitionLink, Location } from '../../api/model'; +import { Position } from '../../common/plugin-api-rpc'; +import { Definition, DefinitionLink, Location } from '../../common/plugin-api-rpc-model'; import { isDefinitionLinkArray, isLocationArray } from './util'; export class DefinitionAdapter { diff --git a/packages/plugin-ext/src/plugin/languages/diagnostics.ts b/packages/plugin-ext/src/plugin/languages/diagnostics.ts index fbb9a2f34f903..ee0ea6e3b80f1 100644 --- a/packages/plugin-ext/src/plugin/languages/diagnostics.ts +++ b/packages/plugin-ext/src/plugin/languages/diagnostics.ts @@ -18,9 +18,9 @@ import * as theia from '@theia/plugin'; import { Event, Emitter } from '@theia/core/lib/common/event'; import { convertDiagnosticToMarkerData } from '../type-converters'; import { DiagnosticSeverity, MarkerSeverity } from '../types-impl'; -import { MarkerData } from '../../api/model'; -import { RPCProtocol } from '../../api/rpc-protocol'; -import { PLUGIN_RPC_CONTEXT, LanguagesMain } from '../../api/plugin-api'; +import { MarkerData } from '../../common/plugin-api-rpc-model'; +import { RPCProtocol } from '../../common/rpc-protocol'; +import { PLUGIN_RPC_CONTEXT, LanguagesMain } from '../../common/plugin-api-rpc'; import URI from 'vscode-uri'; import { v4 } from 'uuid'; @@ -55,7 +55,7 @@ export class DiagnosticCollection implements theia.DiagnosticCollection { set(uri: theia.Uri, diagnostics: theia.Diagnostic[] | undefined): void; set(entries: [theia.Uri, theia.Diagnostic[] | undefined][]): void; - set(arg: theia.Uri | [theia.Uri, theia.Diagnostic[] | undefined][], diagnostics?: theia.Diagnostic[] | undefined) { + set(arg: theia.Uri | [theia.Uri, theia.Diagnostic[] | undefined][], diagnostics?: theia.Diagnostic[] | undefined): void { this.ensureNotDisposed(); if (arg instanceof URI) { @@ -155,7 +155,7 @@ export class DiagnosticCollection implements theia.DiagnosticCollection { } } - setOnDisposeCallback(onDisposeCallback: (() => void) | undefined) { + setOnDisposeCallback(onDisposeCallback: (() => void) | undefined): void { this.onDisposeCallback = onDisposeCallback; } diff --git a/packages/plugin-ext/src/plugin/languages/document-formatting.ts b/packages/plugin-ext/src/plugin/languages/document-formatting.ts index 06f56bc1b041d..0e6f113f62bf3 100644 --- a/packages/plugin-ext/src/plugin/languages/document-formatting.ts +++ b/packages/plugin-ext/src/plugin/languages/document-formatting.ts @@ -18,7 +18,7 @@ import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from '../documents'; import * as Converter from '../type-converters'; import URI from 'vscode-uri/lib/umd'; -import { FormattingOptions, SingleEditOperation } from '../../api/model'; +import { FormattingOptions, SingleEditOperation } from '../../common/plugin-api-rpc-model'; export class DocumentFormattingAdapter { diff --git a/packages/plugin-ext/src/plugin/languages/document-highlight.ts b/packages/plugin-ext/src/plugin/languages/document-highlight.ts index faca1b5665552..a9cb47cfb2737 100644 --- a/packages/plugin-ext/src/plugin/languages/document-highlight.ts +++ b/packages/plugin-ext/src/plugin/languages/document-highlight.ts @@ -19,8 +19,8 @@ import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from '../documents'; import * as types from '../types-impl'; import * as Converter from '../type-converters'; -import { Position } from '../../api/plugin-api'; -import { DocumentHighlight } from '../../api/model'; +import { Position } from '../../common/plugin-api-rpc'; +import { DocumentHighlight } from '../../common/plugin-api-rpc-model'; export class DocumentHighlightAdapter { diff --git a/packages/plugin-ext/src/plugin/languages/folding.ts b/packages/plugin-ext/src/plugin/languages/folding.ts index 8cd1d3de87ef1..a898a92f06d90 100644 --- a/packages/plugin-ext/src/plugin/languages/folding.ts +++ b/packages/plugin-ext/src/plugin/languages/folding.ts @@ -18,7 +18,7 @@ import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from '../documents'; import URI from 'vscode-uri/lib/umd'; import * as Converter from '../type-converters'; -import * as model from '../../api/model'; +import * as model from '../../common/plugin-api-rpc-model'; export class FoldingProviderAdapter { diff --git a/packages/plugin-ext/src/plugin/languages/hover.ts b/packages/plugin-ext/src/plugin/languages/hover.ts index 203cbefcf895a..5e1b36c2e0507 100644 --- a/packages/plugin-ext/src/plugin/languages/hover.ts +++ b/packages/plugin-ext/src/plugin/languages/hover.ts @@ -18,10 +18,10 @@ import URI from 'vscode-uri/lib/umd'; import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from '../documents'; -import { Hover } from '../../api/model'; +import { Hover } from '../../common/plugin-api-rpc-model'; import * as Converter from '../type-converters'; import { Range } from '../types-impl'; -import { Position } from '../../api/plugin-api'; +import { Position } from '../../common/plugin-api-rpc'; export class HoverAdapter { diff --git a/packages/plugin-ext/src/plugin/languages/implementation.ts b/packages/plugin-ext/src/plugin/languages/implementation.ts index 43863bef65bb8..89e829978929f 100644 --- a/packages/plugin-ext/src/plugin/languages/implementation.ts +++ b/packages/plugin-ext/src/plugin/languages/implementation.ts @@ -19,8 +19,8 @@ import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from '../documents'; import * as types from '../types-impl'; import * as Converter from '../type-converters'; -import { Position } from '../../api/plugin-api'; -import { Definition, DefinitionLink, Location } from '../../api/model'; +import { Position } from '../../common/plugin-api-rpc'; +import { Definition, DefinitionLink, Location } from '../../common/plugin-api-rpc-model'; import { isDefinitionLinkArray, isLocationArray } from './util'; export class ImplementationAdapter { diff --git a/packages/plugin-ext/src/plugin/languages/lens.ts b/packages/plugin-ext/src/plugin/languages/lens.ts index 286bc86ab0cc5..0cc942c695674 100644 --- a/packages/plugin-ext/src/plugin/languages/lens.ts +++ b/packages/plugin-ext/src/plugin/languages/lens.ts @@ -17,7 +17,7 @@ import URI from 'vscode-uri/lib/umd'; import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from '../documents'; -import { CodeLensSymbol } from '../../api/model'; +import { CodeLensSymbol } from '../../common/plugin-api-rpc-model'; import * as Converter from '../type-converters'; import { ObjectIdentifier } from '../../common/object-identifier'; diff --git a/packages/plugin-ext/src/plugin/languages/link-provider.ts b/packages/plugin-ext/src/plugin/languages/link-provider.ts index 2ee5f065b4058..ae5291e42042f 100644 --- a/packages/plugin-ext/src/plugin/languages/link-provider.ts +++ b/packages/plugin-ext/src/plugin/languages/link-provider.ts @@ -17,7 +17,7 @@ import URI from 'vscode-uri/lib/umd'; import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from '../documents'; -import { DocumentLink } from '../../api/model'; +import { DocumentLink } from '../../common/plugin-api-rpc-model'; import * as Converter from '../type-converters'; import { ObjectIdentifier } from '../../common/object-identifier'; diff --git a/packages/plugin-ext/src/plugin/languages/on-type-formatting.ts b/packages/plugin-ext/src/plugin/languages/on-type-formatting.ts index f02701f6d6a28..f4c5f19ad5704 100644 --- a/packages/plugin-ext/src/plugin/languages/on-type-formatting.ts +++ b/packages/plugin-ext/src/plugin/languages/on-type-formatting.ts @@ -18,8 +18,8 @@ import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from '../documents'; import * as Converter from '../type-converters'; import URI from 'vscode-uri/lib/umd'; -import { FormattingOptions, SingleEditOperation } from '../../api/model'; -import { Position } from '../../api/plugin-api'; +import { FormattingOptions, SingleEditOperation } from '../../common/plugin-api-rpc-model'; +import { Position } from '../../common/plugin-api-rpc'; export class OnTypeFormattingAdapter { diff --git a/packages/plugin-ext/src/plugin/languages/outline.ts b/packages/plugin-ext/src/plugin/languages/outline.ts index 68d637fd37611..663f0eaf7222a 100644 --- a/packages/plugin-ext/src/plugin/languages/outline.ts +++ b/packages/plugin-ext/src/plugin/languages/outline.ts @@ -18,7 +18,7 @@ import URI from 'vscode-uri/lib/umd'; import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from '../documents'; import * as Converter from '../type-converters'; -import { DocumentSymbol, Range } from '../../api/model'; +import { DocumentSymbol, Range } from '../../common/plugin-api-rpc-model'; import * as types from '../types-impl'; /** Adapts the calls from main to extension thread for providing the document symbols. */ diff --git a/packages/plugin-ext/src/plugin/languages/range-formatting.ts b/packages/plugin-ext/src/plugin/languages/range-formatting.ts index 7d19b39efa00d..acd53da03dcd8 100644 --- a/packages/plugin-ext/src/plugin/languages/range-formatting.ts +++ b/packages/plugin-ext/src/plugin/languages/range-formatting.ts @@ -18,7 +18,7 @@ import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from '../documents'; import * as Converter from '../type-converters'; import URI from 'vscode-uri/lib/umd'; -import { FormattingOptions, SingleEditOperation, Range } from '../../api/model'; +import { FormattingOptions, SingleEditOperation, Range } from '../../common/plugin-api-rpc-model'; export class RangeFormattingAdapter { diff --git a/packages/plugin-ext/src/plugin/languages/reference.ts b/packages/plugin-ext/src/plugin/languages/reference.ts index f9e1dca2457a8..cfe7d1e02e67c 100644 --- a/packages/plugin-ext/src/plugin/languages/reference.ts +++ b/packages/plugin-ext/src/plugin/languages/reference.ts @@ -17,9 +17,9 @@ import URI from 'vscode-uri/lib/umd'; import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from '../documents'; -import { ReferenceContext, Location } from '../../api/model'; +import { ReferenceContext, Location } from '../../common/plugin-api-rpc-model'; import * as Converter from '../type-converters'; -import { Position } from '../../api/plugin-api'; +import { Position } from '../../common/plugin-api-rpc'; import { isLocationArray } from './util'; export class ReferenceAdapter { diff --git a/packages/plugin-ext/src/plugin/languages/rename.ts b/packages/plugin-ext/src/plugin/languages/rename.ts index ddefaeb83d933..e2fac4144700c 100644 --- a/packages/plugin-ext/src/plugin/languages/rename.ts +++ b/packages/plugin-ext/src/plugin/languages/rename.ts @@ -17,9 +17,10 @@ import URI from 'vscode-uri/lib/umd'; import * as theia from '@theia/plugin'; import * as Converter from '../type-converters'; -import * as model from '../../api/model'; +import * as model from '../../common/plugin-api-rpc-model'; import { DocumentsExtImpl } from '../documents'; -import { Position, WorkspaceEditDto } from '../../api/plugin-api'; +import { WorkspaceEditDto } from '../../common/plugin-api-rpc'; +import { Position } from '../../common/plugin-api-rpc'; import { Range } from '../types-impl'; import { isObject } from '../../common/types'; diff --git a/packages/plugin-ext/src/plugin/languages/signature.ts b/packages/plugin-ext/src/plugin/languages/signature.ts index 3311759038fd4..8ff26ec0fc7ed 100644 --- a/packages/plugin-ext/src/plugin/languages/signature.ts +++ b/packages/plugin-ext/src/plugin/languages/signature.ts @@ -18,8 +18,8 @@ import URI from 'vscode-uri/lib/umd'; import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from '../documents'; import * as Converter from '../type-converters'; -import { Position } from '../../api/plugin-api'; -import { SignatureHelp } from '../../api/model'; +import { Position } from '../../common/plugin-api-rpc'; +import { SignatureHelp } from '../../common/plugin-api-rpc-model'; export class SignatureHelpAdapter { diff --git a/packages/plugin-ext/src/plugin/languages/type-definition.ts b/packages/plugin-ext/src/plugin/languages/type-definition.ts index 059189be63e5b..6f8cce88e791c 100644 --- a/packages/plugin-ext/src/plugin/languages/type-definition.ts +++ b/packages/plugin-ext/src/plugin/languages/type-definition.ts @@ -19,8 +19,8 @@ import * as theia from '@theia/plugin'; import { DocumentsExtImpl } from '../documents'; import * as types from '../types-impl'; import * as Converter from '../type-converters'; -import { Position } from '../../api/plugin-api'; -import { Definition, DefinitionLink, Location } from '../../api/model'; +import { Position } from '../../common/plugin-api-rpc'; +import { Definition, DefinitionLink, Location } from '../../common/plugin-api-rpc-model'; import { isDefinitionLinkArray, isLocationArray } from './util'; export class TypeDefinitionAdapter { diff --git a/packages/plugin-ext/src/plugin/message-registry.ts b/packages/plugin-ext/src/plugin/message-registry.ts index bb8a6074bc87d..502da2a57cb0f 100644 --- a/packages/plugin-ext/src/plugin/message-registry.ts +++ b/packages/plugin-ext/src/plugin/message-registry.ts @@ -15,8 +15,8 @@ ********************************************************************************/ import { PLUGIN_RPC_CONTEXT as Ext, MessageRegistryMain, MainMessageOptions, MainMessageType -} from '../api/plugin-api'; -import { RPCProtocol } from '../api/rpc-protocol'; +} from '../common/plugin-api-rpc'; +import { RPCProtocol } from '../common/rpc-protocol'; import { MessageItem, MessageOptions } from '@theia/plugin'; export class MessageRegistryExt { diff --git a/packages/plugin-ext/src/plugin/node/debug/debug.ts b/packages/plugin-ext/src/plugin/node/debug/debug.ts index b16e17860c1ec..821958875bf44 100644 --- a/packages/plugin-ext/src/plugin/node/debug/debug.ts +++ b/packages/plugin-ext/src/plugin/node/debug/debug.ts @@ -19,9 +19,9 @@ import { Path } from '@theia/core/lib/common/path'; import { CommunicationProvider } from '@theia/debug/lib/common/debug-model'; import * as theia from '@theia/plugin'; import URI from 'vscode-uri'; -import { Breakpoint } from '../../../api/model'; -import { DebugExt, DebugMain, PLUGIN_RPC_CONTEXT as Ext, TerminalOptionsExt } from '../../../api/plugin-api'; -import { RPCProtocol } from '../../../api/rpc-protocol'; +import { Breakpoint } from '../../../common/plugin-api-rpc-model'; +import { DebugExt, DebugMain, PLUGIN_RPC_CONTEXT as Ext, TerminalOptionsExt } from '../../../common/plugin-api-rpc'; +import { RPCProtocol } from '../../../common/rpc-protocol'; import { DebuggerContribution } from '../../../common'; import { PluginWebSocketChannel } from '../../../common/connection'; import { CommandRegistryImpl } from '../../command-registry'; @@ -77,7 +77,7 @@ export class DebugExtImpl implements DebugExt { /** * Sets dependencies. */ - assistedInject(connectionExt: ConnectionExtImpl, commandRegistryExt: CommandRegistryImpl) { + assistedInject(connectionExt: ConnectionExtImpl, commandRegistryExt: CommandRegistryImpl): void { this.connectionExt = connectionExt; this.commandRegistryExt = commandRegistryExt; } diff --git a/packages/plugin-ext/src/plugin/node/env-node-ext.ts b/packages/plugin-ext/src/plugin/node/env-node-ext.ts index 14af87d0c49fb..aa87bb93ed5a3 100644 --- a/packages/plugin-ext/src/plugin/node/env-node-ext.ts +++ b/packages/plugin-ext/src/plugin/node/env-node-ext.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { EnvExtImpl } from '../env'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { createHash } from 'crypto'; import { getMac } from 'getmac'; import { v4 } from 'uuid'; diff --git a/packages/plugin-ext/src/plugin/notification.ts b/packages/plugin-ext/src/plugin/notification.ts index d9999e33e67b2..fb60cccb79398 100644 --- a/packages/plugin-ext/src/plugin/notification.ts +++ b/packages/plugin-ext/src/plugin/notification.ts @@ -14,9 +14,9 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { PLUGIN_RPC_CONTEXT, NotificationExt, NotificationMain } from '../api/plugin-api'; +import { PLUGIN_RPC_CONTEXT, NotificationExt, NotificationMain } from '../common/plugin-api-rpc'; import { CancellationToken, Progress, ProgressOptions } from '@theia/plugin'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { RPCProtocol } from '../common/rpc-protocol'; import { Event, Emitter } from '@theia/core/lib/common/event'; import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable'; @@ -78,7 +78,7 @@ class ProgressCallback implements Progress<{ message?: string, increment?: nu this.id = id; this.proxy = proxy; } - report(item: { message?: string, increment?: number }) { + report(item: { message?: string, increment?: number }): void { if (this.id) { this.proxy.$updateProgress(this.id, item); } diff --git a/packages/plugin-ext/src/plugin/output-channel-registry.ts b/packages/plugin-ext/src/plugin/output-channel-registry.ts index 03c98aea2a18f..1a160f1673804 100644 --- a/packages/plugin-ext/src/plugin/output-channel-registry.ts +++ b/packages/plugin-ext/src/plugin/output-channel-registry.ts @@ -15,8 +15,8 @@ ********************************************************************************/ import { PLUGIN_RPC_CONTEXT as Ext, OutputChannelRegistryMain -} from '../api/plugin-api'; -import { RPCProtocol } from '../api/rpc-protocol'; +} from '../common/plugin-api-rpc'; +import { RPCProtocol } from '../common/rpc-protocol'; import * as theia from '@theia/plugin'; import { OutputChannelImpl } from './output-channel/output-channel-item'; diff --git a/packages/plugin-ext/src/plugin/output-channel/output-channel-item.ts b/packages/plugin-ext/src/plugin/output-channel/output-channel-item.ts index 610a5d6b00b66..c0b7f473c31cf 100644 --- a/packages/plugin-ext/src/plugin/output-channel/output-channel-item.ts +++ b/packages/plugin-ext/src/plugin/output-channel/output-channel-item.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ import * as theia from '@theia/plugin'; -import {OutputChannelRegistryMain} from '../../api/plugin-api'; +import {OutputChannelRegistryMain} from '../../common/plugin-api-rpc'; export class OutputChannelImpl implements theia.OutputChannel { diff --git a/packages/plugin-ext/src/plugin/plugin-context.ts b/packages/plugin-ext/src/plugin/plugin-context.ts index 955db8ce944b3..c21d7f123557c 100644 --- a/packages/plugin-ext/src/plugin/plugin-context.ts +++ b/packages/plugin-ext/src/plugin/plugin-context.ts @@ -27,8 +27,8 @@ import { PluginManager, PluginAPIFactory, MainMessageType -} from '../api/plugin-api'; -import { RPCProtocol } from '../api/rpc-protocol'; +} from '../common/plugin-api-rpc'; +import { RPCProtocol } from '../common/rpc-protocol'; import { MessageRegistryExt } from './message-registry'; import { StatusBarMessageRegistryExt } from './status-bar-message-registry'; import { WindowStateExtImpl } from './window-state'; @@ -111,7 +111,7 @@ import { CommentMode, QuickInputButtons } from './types-impl'; -import { SymbolKind } from '../api/model'; +import { SymbolKind } from '../common/plugin-api-rpc-model'; import { EditorsAndDocumentsExtImpl } from './editors-and-documents'; import { TextEditorsExtImpl } from './text-editors'; import { DocumentsExtImpl } from './documents'; @@ -119,7 +119,7 @@ import Uri from 'vscode-uri'; import { TextEditorCursorStyle } from '../common/editor-options'; import { PreferenceRegistryExtImpl } from './preference-registry'; import { OutputChannelRegistryExt } from './output-channel-registry'; -import { TerminalServiceExtImpl } from './terminal-ext'; +import { TerminalServiceExtImpl, TerminalExtImpl } from './terminal-ext'; import { LanguagesExtImpl, score } from './languages'; import { fromDocumentSelector } from './type-converters'; import { DialogsExtImpl } from './dialogs'; @@ -138,6 +138,7 @@ import { QuickPick, QuickPickItem } from '@theia/plugin'; import { ScmExtImpl } from './scm'; import { DecorationProvider, LineChange } from '@theia/plugin'; import { DecorationsExtImpl } from './decorations'; +import { TextEditorExt } from './text-editor'; export function createAPIFactory( rpc: RPCProtocol, @@ -223,34 +224,41 @@ export function createAPIFactory( const showWarningMessage = messageRegistryExt.showMessage.bind(messageRegistryExt, MainMessageType.Warning); const showErrorMessage = messageRegistryExt.showMessage.bind(messageRegistryExt, MainMessageType.Error); const window: typeof theia.window = { - get activeTerminal() { + + get activeTerminal(): TerminalExtImpl | undefined { return terminalExt.activeTerminal; }, - get activeTextEditor() { + get activeTextEditor(): TextEditorExt | undefined { return editors.getActiveEditor(); }, - get visibleTextEditors() { + get visibleTextEditors(): theia.TextEditor[] { return editors.getVisibleTextEditors(); }, - get terminals() { + get terminals(): TerminalExtImpl[] { return terminalExt.terminals; }, onDidChangeActiveTerminal, + // tslint:disable-next-line:typedef onDidChangeActiveTextEditor(listener, thisArg?, disposables?) { return editors.onDidChangeActiveTextEditor(listener, thisArg, disposables); }, + // tslint:disable-next-line:typedef onDidChangeVisibleTextEditors(listener, thisArg?, disposables?) { return editors.onDidChangeVisibleTextEditors(listener, thisArg, disposables); }, + // tslint:disable-next-line:typedef onDidChangeTextEditorSelection(listener, thisArg?, disposables?) { return editors.onDidChangeTextEditorSelection(listener, thisArg, disposables); }, + // tslint:disable-next-line:typedef onDidChangeTextEditorOptions(listener, thisArg?, disposables?) { return editors.onDidChangeTextEditorOptions(listener, thisArg, disposables); }, + // tslint:disable-next-line:typedef onDidChangeTextEditorViewColumn(listener, thisArg?, disposables?) { return editors.onDidChangeTextEditorViewColumn(listener, thisArg, disposables); }, + // tslint:disable-next-line:typedef onDidChangeTextEditorVisibleRanges(listener, thisArg?, disposables?) { return editors.onDidChangeTextEditorVisibleRanges(listener, thisArg, disposables); }, @@ -311,7 +319,7 @@ export function createAPIFactory( setStatusBarMessage(text: string, arg?: number | PromiseLike): Disposable { return statusBarMessageRegistryExt.setStatusBarMessage(text, arg); }, - showInputBox(options?: theia.InputBoxOptions, token?: theia.CancellationToken) { + showInputBox(options?: theia.InputBoxOptions, token?: theia.CancellationToken): PromiseLike { if (token) { const coreEvent = Object.assign(token.onCancellationRequested, { maxListeners: 0 }); const coreCancellationToken = { isCancellationRequested: token.isCancellationRequested, onCancellationRequested: coreEvent }; @@ -391,21 +399,26 @@ export function createAPIFactory( onDidChangeWorkspaceFolders(listener, thisArg?, disposables?): theia.Disposable { return workspaceExt.onDidChangeWorkspaceFolders(listener, thisArg, disposables); }, - get textDocuments() { + get textDocuments(): theia.TextDocument[] { return documents.getAllDocumentData().map(data => data.document); }, + // tslint:disable-next-line:typedef onDidChangeTextDocument(listener, thisArg?, disposables?) { return documents.onDidChangeDocument(listener, thisArg, disposables); }, + // tslint:disable-next-line:typedef onDidCloseTextDocument(listener, thisArg?, disposables?) { return documents.onDidRemoveDocument(listener, thisArg, disposables); }, + // tslint:disable-next-line:typedef onDidOpenTextDocument(listener, thisArg?, disposables?) { return documents.onDidAddDocument(listener, thisArg, disposables); }, + // tslint:disable-next-line:typedef onWillSaveTextDocument(listener, thisArg?, disposables?) { return documents.onWillSaveTextDocument(listener, thisArg, disposables); }, + // tslint:disable-next-line:typedef onDidSaveTextDocument(listener, thisArg?, disposables?) { return documents.onDidSaveTextDocument(listener, thisArg, disposables); }, @@ -478,12 +491,12 @@ export function createAPIFactory( }; const env: typeof theia.env = Object.freeze({ - get appName() { return envExt.appName; }, - get appRoot() { return envExt.appRoot; }, - get language() { return envExt.language; }, - get machineId() { return envExt.machineId; }, - get sessionId() { return envExt.sessionId; }, - get uriScheme() { return envExt.uriScheme; }, + get appName(): string { return envExt.appName; }, + get appRoot(): string { return envExt.appRoot; }, + get language(): string { return envExt.language; }, + get machineId(): string { return envExt.machineId; }, + get sessionId(): string { return envExt.sessionId; }, + get uriScheme(): string { return envExt.uriScheme; }, getEnvVariable(envVarName: string): PromiseLike { return envExt.getEnvVariable(envVarName); @@ -522,6 +535,7 @@ export function createAPIFactory( get onDidChangeDiagnostics(): theia.Event { return languagesExt.onDidChangeDiagnostics; }, + // tslint:disable-next-line:typedef getDiagnostics(resource?: Uri) { // tslint:disable-next-line:no-any return languagesExt.getDiagnostics(resource); @@ -670,19 +684,19 @@ export function createAPIFactory( get taskExecutions(): ReadonlyArray { return tasksExt.taskExecutions; }, - + // tslint:disable-next-line:typedef onDidStartTask(listener, thisArg?, disposables?) { return tasksExt.onDidStartTask(listener, thisArg, disposables); }, - + // tslint:disable-next-line:typedef onDidEndTask(listener, thisArg?, disposables?) { return tasksExt.onDidEndTask(listener, thisArg, disposables); }, - + // tslint:disable-next-line:typedef onDidStartTaskProcess(listener, thisArg?, disposables?) { return tasksExt.onDidStartTaskProcess(listener, thisArg, disposables); }, - + // tslint:disable-next-line:typedef onDidEndTaskProcess(listener, thisArg?, disposables?) { return tasksExt.onDidEndTaskProcess(listener, thisArg, disposables); } diff --git a/packages/plugin-ext/src/plugin/plugin-manager.ts b/packages/plugin-ext/src/plugin/plugin-manager.ts index 8593fbfb5b3cc..bcd300e24a1c1 100644 --- a/packages/plugin-ext/src/plugin/plugin-manager.ts +++ b/packages/plugin-ext/src/plugin/plugin-manager.ts @@ -23,7 +23,7 @@ import { Plugin, PluginAPI, ConfigStorage -} from '../api/plugin-api'; +} from '../common/plugin-api-rpc'; import { PluginMetadata } from '../common/plugin-protocol'; import * as theia from '@theia/plugin'; import { join } from 'path'; @@ -33,7 +33,7 @@ import { EnvExtImpl } from './env'; import { PreferenceRegistryExtImpl } from './preference-registry'; import { Memento, KeyValueStorageProxy } from './plugin-storage'; import { ExtPluginApi } from '../common/plugin-ext-api-contribution'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { RPCProtocol } from '../common/rpc-protocol'; import { Emitter } from '@theia/core/lib/common/event'; export interface PluginHost { @@ -307,7 +307,7 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager { } // for electron -function getGlobal() { +function getGlobal(): Window | NodeJS.Global | null { // tslint:disable-next-line:no-null-keyword return typeof self === 'undefined' ? typeof global === 'undefined' ? null : global : self; } diff --git a/packages/plugin-ext/src/plugin/plugin-storage.ts b/packages/plugin-ext/src/plugin/plugin-storage.ts index 2c35d54171699..eafca646e5cac 100644 --- a/packages/plugin-ext/src/plugin/plugin-storage.ts +++ b/packages/plugin-ext/src/plugin/plugin-storage.ts @@ -16,7 +16,7 @@ import * as theia from '@theia/plugin'; import { Event, Emitter } from '@theia/core/lib/common/event'; -import { StorageMain, StorageExt } from '../api/plugin-api'; +import { StorageMain, StorageExt } from '../common/plugin-api-rpc'; import { KeysToAnyValues, KeysToKeysToAnyValue } from '../common/types'; export class Memento implements theia.Memento { diff --git a/packages/plugin-ext/src/plugin/preference-registry.ts b/packages/plugin-ext/src/plugin/preference-registry.ts index 09ae0d59de3b7..3d50d8915c419 100644 --- a/packages/plugin-ext/src/plugin/preference-registry.ts +++ b/packages/plugin-ext/src/plugin/preference-registry.ts @@ -24,8 +24,8 @@ import { PreferenceRegistryMain, PreferenceData, PreferenceChangeExt -} from '../api/plugin-api'; -import { RPCProtocol } from '../api/rpc-protocol'; +} from '../common/plugin-api-rpc'; +import { RPCProtocol } from '../common/rpc-protocol'; import { isObject, mixin } from '../common/types'; import { Configuration, ConfigurationModel } from './preferences/configuration'; import { WorkspaceExtImpl } from './workspace'; diff --git a/packages/plugin-ext/src/plugin/quick-open.ts b/packages/plugin-ext/src/plugin/quick-open.ts index 62f11fd609524..f67188d362c52 100644 --- a/packages/plugin-ext/src/plugin/quick-open.ts +++ b/packages/plugin-ext/src/plugin/quick-open.ts @@ -13,12 +13,12 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { QuickOpenExt, PLUGIN_RPC_CONTEXT as Ext, QuickOpenMain, TransferInputBox, Plugin } from '../api/plugin-api'; +import { QuickOpenExt, PLUGIN_RPC_CONTEXT as Ext, QuickOpenMain, TransferInputBox, Plugin } from '../common/plugin-api-rpc'; import { QuickPickOptions, QuickPickItem, InputBoxOptions, InputBox, QuickPick, QuickInput } from '@theia/plugin'; import { CancellationToken } from '@theia/core/lib/common/cancellation'; -import { RPCProtocol } from '../api/rpc-protocol'; -import { anyPromise } from '../api/async-util'; -import { hookCancellationToken } from '../api/async-util'; +import { RPCProtocol } from '../common/rpc-protocol'; +import { anyPromise } from '../common/async-util'; +import { hookCancellationToken } from '../common/async-util'; import { Emitter, Event } from '@theia/core/lib/common/event'; import { DisposableCollection } from '@theia/core/lib/common/disposable'; import { QuickInputButtons, QuickInputButton, ThemeIcon } from './types-impl'; diff --git a/packages/plugin-ext/src/plugin/scm.ts b/packages/plugin-ext/src/plugin/scm.ts index 9030c3d173850..209e9a09fcf43 100644 --- a/packages/plugin-ext/src/plugin/scm.ts +++ b/packages/plugin-ext/src/plugin/scm.ts @@ -15,8 +15,8 @@ ********************************************************************************/ import * as theia from '@theia/plugin'; -import { CommandRegistryExt, Plugin as InternalPlugin, PLUGIN_RPC_CONTEXT, ScmExt, ScmMain, ScmCommandArg } from '../api/plugin-api'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { CommandRegistryExt, Plugin as InternalPlugin, PLUGIN_RPC_CONTEXT, ScmExt, ScmMain, ScmCommandArg } from '../common/plugin-api-rpc'; +import { RPCProtocol } from '../common/rpc-protocol'; import { CancellationToken } from '@theia/core'; import { UriComponents } from '../common/uri-components'; import URI from '@theia/core/lib/common/uri'; diff --git a/packages/plugin-ext/src/plugin/status-bar-message-registry.ts b/packages/plugin-ext/src/plugin/status-bar-message-registry.ts index 9cfa07add1855..a8183b4af6be6 100644 --- a/packages/plugin-ext/src/plugin/status-bar-message-registry.ts +++ b/packages/plugin-ext/src/plugin/status-bar-message-registry.ts @@ -17,8 +17,8 @@ import { Disposable, StatusBarAlignment } from './types-impl'; import { StatusBarItem } from '@theia/plugin'; import { PLUGIN_RPC_CONTEXT as Ext, StatusBarMessageRegistryMain -} from '../api/plugin-api'; -import { RPCProtocol } from '../api/rpc-protocol'; +} from '../common/plugin-api-rpc'; +import { RPCProtocol } from '../common/rpc-protocol'; import { StatusBarItemImpl } from './status-bar/status-bar-item'; /*--------------------------------------------------------------------------------------------- @@ -72,7 +72,7 @@ class StatusBarMessage { this._item = statusBar.createStatusBarItem(StatusBarAlignment.Left, Number.MIN_VALUE); } - dispose() { + dispose(): void { this._messages.length = 0; this._item.dispose(); } @@ -91,7 +91,7 @@ class StatusBarMessage { }); } - private _update() { + private _update(): void { if (this._messages.length > 0) { this._item.text = this._messages[0].message; this._item.show(); diff --git a/packages/plugin-ext/src/plugin/status-bar/status-bar-item.ts b/packages/plugin-ext/src/plugin/status-bar/status-bar-item.ts index 2abc47ac654dc..15517e8079ade 100644 --- a/packages/plugin-ext/src/plugin/status-bar/status-bar-item.ts +++ b/packages/plugin-ext/src/plugin/status-bar/status-bar-item.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import * as theia from '@theia/plugin'; import { ThemeColor, StatusBarAlignment } from '../types-impl'; -import { StatusBarMessageRegistryMain } from '../../api/plugin-api'; +import { StatusBarMessageRegistryMain } from '../../common/plugin-api-rpc'; import { VS_COLORS } from './vscolor-const'; import { UUID } from '@phosphor/coreutils/lib/uuid'; diff --git a/packages/plugin-ext/src/plugin/statusBar.ts b/packages/plugin-ext/src/plugin/statusBar.ts index c6c91781226a4..12a45da0494dc 100644 --- a/packages/plugin-ext/src/plugin/statusBar.ts +++ b/packages/plugin-ext/src/plugin/statusBar.ts @@ -14,9 +14,9 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { PLUGIN_RPC_CONTEXT, StatusBarExt, StatusBarMessageRegistryMain } from '../api/plugin-api'; +import { PLUGIN_RPC_CONTEXT, StatusBarExt, StatusBarMessageRegistryMain } from '../common/plugin-api-rpc'; import { CancellationToken, Progress, ProgressOptions } from '@theia/plugin'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { RPCProtocol } from '../common/rpc-protocol'; import { Event, Emitter } from '@theia/core/lib/common/event'; import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable'; import { StatusBarItemImpl } from './status-bar/status-bar-item'; @@ -77,7 +77,7 @@ class ProgressCallback implements Progress<{ message?: string, increment?: nu this.message = message; this.proxy = proxy; } - report(item: { message?: string, increment?: number }) { + report(item: { message?: string, increment?: number }): void { this.proxy.$update(this.id, this.message + (item.message ? ': ' + ' ' + item.message : '')); } } diff --git a/packages/plugin-ext/src/plugin/tasks/tasks.ts b/packages/plugin-ext/src/plugin/tasks/tasks.ts index d78faa155268e..c6551e4888080 100644 --- a/packages/plugin-ext/src/plugin/tasks/tasks.ts +++ b/packages/plugin-ext/src/plugin/tasks/tasks.ts @@ -20,11 +20,11 @@ import { TasksMain, TaskDto, TaskExecutionDto -} from '../../api/plugin-api'; +} from '../../common/plugin-api-rpc'; import * as theia from '@theia/plugin'; import * as converter from '../type-converters'; import { Disposable } from '../types-impl'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { TaskProviderAdapter } from './task-provider'; import { Emitter, Event } from '@theia/core/lib/common/event'; @@ -144,7 +144,7 @@ export class TasksExtImpl implements TasksExt { }); } - private async fetchTaskExecutions() { + private async fetchTaskExecutions(): Promise { try { const taskExecutions = await this.proxy.$taskExecutions(); taskExecutions.forEach(execution => this.getTaskExecution(execution)); diff --git a/packages/plugin-ext/src/plugin/terminal-ext.ts b/packages/plugin-ext/src/plugin/terminal-ext.ts index 9347bfabee1c4..887b0258ba701 100644 --- a/packages/plugin-ext/src/plugin/terminal-ext.ts +++ b/packages/plugin-ext/src/plugin/terminal-ext.ts @@ -15,8 +15,8 @@ ********************************************************************************/ import { UUID } from '@phosphor/coreutils/lib/uuid'; import { Terminal, TerminalOptions } from '@theia/plugin'; -import { TerminalServiceExt, TerminalServiceMain, PLUGIN_RPC_CONTEXT } from '../api/plugin-api'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { TerminalServiceExt, TerminalServiceMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc'; +import { RPCProtocol } from '../common/rpc-protocol'; import { Emitter } from '@theia/core/lib/common/event'; import { Deferred } from '@theia/core/lib/common/promise-util'; import * as theia from '@theia/plugin'; diff --git a/packages/plugin-ext/src/plugin/text-editor.ts b/packages/plugin-ext/src/plugin/text-editor.ts index 3fdcf3795288c..8c9499eb722a3 100644 --- a/packages/plugin-ext/src/plugin/text-editor.ts +++ b/packages/plugin-ext/src/plugin/text-editor.ts @@ -13,8 +13,8 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { TextEditorConfiguration, TextEditorsMain, TextEditorConfigurationUpdate, SingleEditOperation } from '../api/plugin-api'; -import { Range as ApiRange } from '../api/model'; +import { TextEditorConfiguration, TextEditorsMain, TextEditorConfigurationUpdate, SingleEditOperation } from '../common/plugin-api-rpc'; +import { Range as ApiRange } from '../common/plugin-api-rpc-model'; import { Selection, Range, TextEditorLineNumbersStyle, SnippetString, Position, TextEditorRevealType, EndOfLine } from './types-impl'; import * as theia from '@theia/plugin'; import { DocumentDataExt } from './document-data'; @@ -128,7 +128,7 @@ export class TextEditorExt implements theia.TextEditor { throw readonly('viewColumn'); } - _acceptViewColumn(value: theia.ViewColumn) { + _acceptViewColumn(value: theia.ViewColumn): void { ok(!this.disposed); this._viewColumn = value; } @@ -368,7 +368,7 @@ export class TextEditorOptionsExt implements theia.TextEditorOptions { warnOnError(this.proxy.$trySetOptions(this.id, { lineNumbers: val })); } - public assign(newOptions: theia.TextEditorOptions) { + public assign(newOptions: theia.TextEditorOptions): void { const configurationUpdate: TextEditorConfigurationUpdate = {}; let hasUpdate = false; diff --git a/packages/plugin-ext/src/plugin/text-editors.ts b/packages/plugin-ext/src/plugin/text-editors.ts index e99cc8c499a94..78ab6dd8eb315 100644 --- a/packages/plugin-ext/src/plugin/text-editors.ts +++ b/packages/plugin-ext/src/plugin/text-editors.ts @@ -14,8 +14,8 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { TextEditorsExt, EditorChangedPropertiesData, TextEditorPositionData, TextEditorsMain, PLUGIN_RPC_CONTEXT } from '../api/plugin-api'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { TextEditorsExt, EditorChangedPropertiesData, TextEditorPositionData, TextEditorsMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc'; +import { RPCProtocol } from '../common/rpc-protocol'; import * as theia from '@theia/plugin'; import { Emitter, Event } from '@theia/core/lib/common/event'; import { EditorsAndDocumentsExtImpl } from './editors-and-documents'; diff --git a/packages/plugin-ext/src/plugin/tree/tree-views.ts b/packages/plugin-ext/src/plugin/tree/tree-views.ts index 85f69e1c0b3e1..70eeb4f570873 100644 --- a/packages/plugin-ext/src/plugin/tree/tree-views.ts +++ b/packages/plugin-ext/src/plugin/tree/tree-views.ts @@ -21,8 +21,8 @@ import URI from 'vscode-uri'; import { TreeDataProvider, TreeView, TreeViewExpansionEvent, TreeItem2, TreeItemLabel } from '@theia/plugin'; import { Emitter } from '@theia/core/lib/common/event'; import { Disposable, ThemeIcon } from '../types-impl'; -import { Plugin, PLUGIN_RPC_CONTEXT, TreeViewsExt, TreeViewsMain, TreeViewItem } from '../../api/plugin-api'; -import { RPCProtocol } from '../../api/rpc-protocol'; +import { Plugin, PLUGIN_RPC_CONTEXT, TreeViewsExt, TreeViewsMain, TreeViewItem } from '../../common/plugin-api-rpc'; +import { RPCProtocol } from '../../common/rpc-protocol'; import { CommandRegistryImpl } from '../command-registry'; import { TreeViewSelection } from '../../common'; import { PluginPackage } from '../../common/plugin-protocol'; @@ -65,14 +65,15 @@ export class TreeViewsExtImpl implements TreeViewsExt { this.treeViews.set(treeViewId, treeView); return { + // tslint:disable-next-line:typedef get onDidExpandElement() { return treeView.onDidExpandElement; }, - + // tslint:disable-next-line:typedef get onDidCollapseElement() { return treeView.onDidCollapseElement; }, - + // tslint:disable-next-line:typedef get selection() { return treeView.selectedElements; }, diff --git a/packages/plugin-ext/src/plugin/type-converters.spec.ts b/packages/plugin-ext/src/plugin/type-converters.spec.ts index e6d726e18df99..620d5e441fba9 100644 --- a/packages/plugin-ext/src/plugin/type-converters.spec.ts +++ b/packages/plugin-ext/src/plugin/type-converters.spec.ts @@ -18,9 +18,9 @@ import * as assert from 'assert'; import * as Converter from './type-converters'; import * as theia from '@theia/plugin'; import * as types from './types-impl'; -import * as model from '../api/model'; +import * as model from '../common/plugin-api-rpc-model'; import { MarkdownString, isMarkdownString } from './markdown-string'; -import { ProcessTaskDto, TaskDto } from '../api/plugin-api'; +import { ProcessTaskDto, TaskDto } from '../common/plugin-api-rpc'; describe('Type converters:', () => { diff --git a/packages/plugin-ext/src/plugin/type-converters.ts b/packages/plugin-ext/src/plugin/type-converters.ts index c5ba91f9abdc6..8b3b3ec1ba8c4 100644 --- a/packages/plugin-ext/src/plugin/type-converters.ts +++ b/packages/plugin-ext/src/plugin/type-converters.ts @@ -15,10 +15,18 @@ ********************************************************************************/ import { - EditorPosition, Selection, Position, DecorationOptions, WorkspaceEditDto, ResourceTextEditDto, ResourceFileEditDto, TaskDto, - ProcessTaskDto, PickOpenItem -} from '../api/plugin-api'; -import * as model from '../api/model'; + EditorPosition, + Selection, + Position, + DecorationOptions, + WorkspaceEditDto, + ResourceTextEditDto, + ResourceFileEditDto, + TaskDto, + ProcessTaskDto, + PickOpenItem +} from '../common/plugin-api-rpc'; +import * as model from '../common/plugin-api-rpc-model'; import * as theia from '@theia/plugin'; import * as types from './types-impl'; import { LanguageSelector, LanguageFilter, RelativePattern } from './languages'; @@ -496,7 +504,7 @@ export namespace KnownCommands { } function toArrayConversion(f: (a: T) => U): (a: T[]) => U[] { - return function (a: T[]) { + return function (a: T[]): U[] { return a.map(f); }; } diff --git a/packages/plugin-ext/src/plugin/types-impl.ts b/packages/plugin-ext/src/plugin/types-impl.ts index 90f2a5640f617..6023bdca848fd 100644 --- a/packages/plugin-ext/src/plugin/types-impl.ts +++ b/packages/plugin-ext/src/plugin/types-impl.ts @@ -22,7 +22,7 @@ import URI from 'vscode-uri'; import { relative } from '../common/paths-util'; import { startsWithIgnoreCase } from '../common/strings'; import { MarkdownString, isMarkdownString } from './markdown-string'; -import { SymbolKind } from '../api/model'; +import { SymbolKind } from '../common/plugin-api-rpc-model'; export class Disposable { private disposable: undefined | (() => void); @@ -99,7 +99,7 @@ export enum TextEditorSelectionChangeKind { } export namespace TextEditorSelectionChangeKind { - export function fromValue(s: string | undefined) { + export function fromValue(s: string | undefined): TextEditorSelectionChangeKind | undefined { switch (s) { case 'keyboard': return TextEditorSelectionChangeKind.Keyboard; case 'mouse': return TextEditorSelectionChangeKind.Mouse; @@ -1529,7 +1529,7 @@ export class TaskGroup { public static Rebuild: TaskGroup = new TaskGroup('rebuild', 'Rebuild'); public static Test: TaskGroup = new TaskGroup('test', 'Test'); - public static from(value: string) { + public static from(value: string): TaskGroup | undefined { switch (value) { case 'clean': return TaskGroup.Clean; diff --git a/packages/plugin-ext/src/plugin/webviews.ts b/packages/plugin-ext/src/plugin/webviews.ts index 4618e2be889cd..0afe3cb561aec 100644 --- a/packages/plugin-ext/src/plugin/webviews.ts +++ b/packages/plugin-ext/src/plugin/webviews.ts @@ -14,9 +14,9 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { WebviewsExt, WebviewPanelViewState, WebviewsMain, PLUGIN_RPC_CONTEXT, /* WebviewsMain, PLUGIN_RPC_CONTEXT */ } from '../api/plugin-api'; +import { WebviewsExt, WebviewPanelViewState, WebviewsMain, PLUGIN_RPC_CONTEXT, /* WebviewsMain, PLUGIN_RPC_CONTEXT */ } from '../common/plugin-api-rpc'; import * as theia from '@theia/plugin'; -import { RPCProtocol } from '../api/rpc-protocol'; +import { RPCProtocol } from '../common/rpc-protocol'; import URI from 'vscode-uri/lib/umd'; import { Emitter, Event } from '@theia/core/lib/common/event'; import { fromViewColumn, toViewColumn, toWebviewPanelShowOptions } from './type-converters'; @@ -137,7 +137,7 @@ export class WebviewImpl implements theia.Webview { this._options = options!; } - dispose() { + dispose(): void { if (this.isDisposed) { return; } @@ -157,7 +157,7 @@ export class WebviewImpl implements theia.Webview { return this.proxy.$postMessage(this.viewId, JSON.parse(newMessage)); } - protected filterLocalRoots(content: string, localResourceRoots: ReadonlyArray) { + protected filterLocalRoots(content: string, localResourceRoots: ReadonlyArray): string { const webViewsRegExp = /"(\/webview\/.*?)\"/g; let m; while ((m = webViewsRegExp.exec(content)) !== null) { @@ -203,7 +203,7 @@ export class WebviewImpl implements theia.Webview { } } - private checkIsDisposed() { + private checkIsDisposed(): void { if (this.isDisposed) { throw new Error('This Webview is disposed!'); } @@ -235,7 +235,7 @@ export class WebviewPanelImpl implements theia.WebviewPanel { this.setViewColumn(undefined); } - dispose() { + dispose(): void { if (this.isDisposed) { return; } @@ -280,7 +280,7 @@ export class WebviewPanelImpl implements theia.WebviewPanel { } } - get webview() { + get webview(): WebviewImpl { this.checkIsDisposed(); return this._webview; } @@ -295,7 +295,7 @@ export class WebviewPanelImpl implements theia.WebviewPanel { return this._showOptions.viewColumn; } - setViewColumn(value: theia.ViewColumn | undefined) { + setViewColumn(value: theia.ViewColumn | undefined): void { this.checkIsDisposed(); this._showOptions.viewColumn = value; } @@ -305,7 +305,7 @@ export class WebviewPanelImpl implements theia.WebviewPanel { return this._showOptions; } - setShowOptions(value: theia.WebviewPanelShowOptions) { + setShowOptions(value: theia.WebviewPanelShowOptions): void { this.checkIsDisposed(); this._showOptions = value; } @@ -315,7 +315,7 @@ export class WebviewPanelImpl implements theia.WebviewPanel { return this._active; } - setActive(value: boolean) { + setActive(value: boolean): void { this.checkIsDisposed(); this._active = value; } @@ -325,7 +325,7 @@ export class WebviewPanelImpl implements theia.WebviewPanel { return this._visible; } - setVisible(value: boolean) { + setVisible(value: boolean): void { this.checkIsDisposed(); this._visible = value; } @@ -361,7 +361,7 @@ export class WebviewPanelImpl implements theia.WebviewPanel { return this.proxy.$postMessage(this.viewId, message); } - private checkIsDisposed() { + private checkIsDisposed(): void { if (this.isDisposed) { throw new Error('This WebviewPanel is disposed!'); } diff --git a/packages/plugin-ext/src/plugin/window-state.ts b/packages/plugin-ext/src/plugin/window-state.ts index db7d60e121935..3578377754926 100644 --- a/packages/plugin-ext/src/plugin/window-state.ts +++ b/packages/plugin-ext/src/plugin/window-state.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { WindowState } from '@theia/plugin'; -import { WindowStateExt } from '../api/plugin-api'; +import { WindowStateExt } from '../common/plugin-api-rpc'; import { Event, Emitter } from '@theia/core/lib/common/event'; export class WindowStateExtImpl implements WindowStateExt { diff --git a/packages/plugin-ext/src/plugin/workspace.ts b/packages/plugin-ext/src/plugin/workspace.ts index 2a2419c16e393..e051eb796cfb3 100644 --- a/packages/plugin-ext/src/plugin/workspace.ts +++ b/packages/plugin-ext/src/plugin/workspace.ts @@ -29,10 +29,10 @@ import { WorkspaceMain, PLUGIN_RPC_CONTEXT as Ext, MainMessageType -} from '../api/plugin-api'; +} from '../common/plugin-api-rpc'; import { Path } from '@theia/core/lib/common/path'; -import { RPCProtocol } from '../api/rpc-protocol'; -import { WorkspaceRootsChangeEvent, FileChangeEvent, FileMoveEvent, FileWillMoveEvent } from '../api/model'; +import { RPCProtocol } from '../common/rpc-protocol'; +import { WorkspaceRootsChangeEvent, FileChangeEvent, FileMoveEvent, FileWillMoveEvent } from '../common/plugin-api-rpc-model'; import { EditorsAndDocumentsExtImpl } from './editors-and-documents'; import { InPluginFileSystemWatcherProxy } from './in-plugin-filesystem-watcher-proxy'; import URI from 'vscode-uri'; @@ -197,7 +197,7 @@ export class WorkspaceExtImpl implements WorkspaceExt { const instance = this; return { - dispose() { + dispose(): void { if (instance.documentContentProviders.delete(scheme)) { instance.proxy.$unregisterTextDocumentContentProvider(scheme); } @@ -358,7 +358,7 @@ export class WorkspaceExtImpl implements WorkspaceExt { */ public readonly onDidRenameFile: Event = this.workspaceDidRenameFileEmitter.event; - $onFileRename(event: FileMoveEvent) { + $onFileRename(event: FileMoveEvent): void { this.workspaceDidRenameFileEmitter.fire(Object.freeze({ oldUri: URI.revive(event.oldUri), newUri: URI.revive(event.newUri) })); } diff --git a/packages/preferences/src/browser/preference-service.spec.ts b/packages/preferences/src/browser/preference-service.spec.ts index 37635f21d1f45..32819f63dd313 100644 --- a/packages/preferences/src/browser/preference-service.spec.ts +++ b/packages/preferences/src/browser/preference-service.spec.ts @@ -72,7 +72,7 @@ const mockUserPreferenceEmitter = new Emitter(); const mockWorkspacePreferenceEmitter = new Emitter(); const mockFolderPreferenceEmitter = new Emitter(); -function testContainerSetup() { +function testContainerSetup(): void { testContainer = new Container(); bindPreferenceSchemaProvider(testContainer.bind.bind(testContainer)); @@ -137,7 +137,7 @@ function testContainerSetup() { const resourceProvider = new MockResourceProvider(); sinon.stub(resourceProvider, 'get').callsFake(() => Promise.resolve({ uri: new URI(''), - dispose() { }, + dispose(): void { }, readContents(): Promise { return fs.readFile(tempPath, 'utf-8'); }, @@ -658,7 +658,10 @@ describe('Preference Service', () => { assert.strictEqual(true, preferences.get('[go].editor.formatOnSave')); }); - function prepareServices(options?: { schema: PreferenceSchema }) { + function prepareServices(options?: { schema: PreferenceSchema }): { + preferences: PreferenceServiceImpl; + schema: PreferenceSchemaProvider; + } { const container = new Container(); bindPreferenceSchemaProvider(container.bind.bind(container)); container.bind(PreferenceProviderProvider).toFactory(() => () => new MockPreferenceProvider()); diff --git a/packages/preferences/src/browser/preferences-decorator.ts b/packages/preferences/src/browser/preferences-decorator.ts index 75d5ee10f9522..a5cec2bab77f5 100644 --- a/packages/preferences/src/browser/preferences-decorator.ts +++ b/packages/preferences/src/browser/preferences-decorator.ts @@ -68,7 +68,7 @@ export class PreferencesDecorator implements TreeDecorator { return this.preferencesDecorations; } - setActiveFolder(folder: string) { + setActiveFolder(folder: string): void { this.activeFolderUri = folder; this.fireDidChangeDecorations(this.preferences); } diff --git a/packages/preferences/src/browser/preferences-frontend-application-contribution.ts b/packages/preferences/src/browser/preferences-frontend-application-contribution.ts index 894b9cc5699a3..fc3297c851a25 100644 --- a/packages/preferences/src/browser/preferences-frontend-application-contribution.ts +++ b/packages/preferences/src/browser/preferences-frontend-application-contribution.ts @@ -28,7 +28,7 @@ export class PreferencesFrontendApplicationContribution implements FrontendAppli @inject(PreferenceSchemaProvider) schemaProvider: PreferenceSchemaProvider; @inject(InMemoryResources) inmemoryResources: InMemoryResources; - onStart() { + onStart(): void { const serializeSchema = () => JSON.stringify(this.schemaProvider.getCombinedSchema()); const uri = new URI('vscode://schemas/settings/user'); this.inmemoryResources.add(uri, serializeSchema()); diff --git a/packages/preferences/src/browser/preferences-tree-widget.ts b/packages/preferences/src/browser/preferences-tree-widget.ts index 9cef95f040c37..8cc40aa09db4c 100644 --- a/packages/preferences/src/browser/preferences-tree-widget.ts +++ b/packages/preferences/src/browser/preferences-tree-widget.ts @@ -194,7 +194,7 @@ export class PreferencesContainer extends SplitPanel implements ApplicationShell super.onActivateRequest(msg); } - protected onCloseRequest(msg: Message) { + protected onCloseRequest(msg: Message): void { if (this.treeWidget) { this.treeWidget.close(); } @@ -293,12 +293,12 @@ export class PreferencesEditorsContainer extends DockPanel { super.dispose(); } - onCloseRequest(msg: Message) { + onCloseRequest(msg: Message): void { toArray(this.widgets()).forEach(widget => widget.close()); super.onCloseRequest(msg); } - onUpdateRequest(msg: Message) { + onUpdateRequest(msg: Message): void { const editor = this.selectedWidgets().next(); if (editor) { this.onEditorChangedEmitter.fire(editor); @@ -412,7 +412,7 @@ export class PreferencesEditorsContainer extends DockPanel { return configUri; } - activatePreferenceEditor(preferenceScope: PreferenceScope) { + activatePreferenceEditor(preferenceScope: PreferenceScope): void { for (const widget of toArray(this.widgets())) { const preferenceEditor = widget as PreferencesEditorWidget; if (preferenceEditor.scope === preferenceScope) { @@ -593,7 +593,7 @@ export class PreferencesTreeWidget extends TreeWidget { this.model.root = root; } - setActiveFolder(folder: string) { + setActiveFolder(folder: string): void { this.activeFolderUri = folder; this.decorator.setActiveFolder(folder); } diff --git a/packages/preferences/src/browser/user-preference-provider.ts b/packages/preferences/src/browser/user-preference-provider.ts index 8e4fe0fab3162..d5a186d7e3359 100644 --- a/packages/preferences/src/browser/user-preference-provider.ts +++ b/packages/preferences/src/browser/user-preference-provider.ts @@ -28,7 +28,7 @@ export class UserPreferenceProvider extends AbstractResourcePreferenceProvider { return USER_PREFERENCE_URI; } - protected getScope() { + protected getScope(): PreferenceScope { return PreferenceScope.User; } } diff --git a/packages/preview/src/browser/markdown/markdown-preview-handler.spec.ts b/packages/preview/src/browser/markdown/markdown-preview-handler.spec.ts index d8304e07db904..8d0254efa6b0b 100644 --- a/packages/preview/src/browser/markdown/markdown-preview-handler.spec.ts +++ b/packages/preview/src/browser/markdown/markdown-preview-handler.spec.ts @@ -107,8 +107,8 @@ describe('markdown-preview-handler', () => { }); }); -async function assertRenderedContent(source: string, expectation: string) { - const contentElement = await previewHandler.renderContent({ content: source, originUri: new URI('file:///workspace/DEMO.md') }); +async function assertRenderedContent(source: string, expectation: string): Promise { + const contentElement = previewHandler.renderContent({ content: source, originUri: new URI('file:///workspace/DEMO.md') }); expect(contentElement.innerHTML).equals(expectation); } @@ -188,13 +188,14 @@ const exampleHtml5 = // /** * `offsetTop` of elements to be `sourceLine` number times `20`. */ -function mockOffsetProperties() { +function mockOffsetProperties(): void { Object.defineProperties(HTMLElement.prototype, { offsetLeft: { get: () => 0 }, offsetTop: { - get: function () { + // tslint:disable-next-line:no-any + get: function (): any { const element = this as HTMLElement; const line = Number.parseInt(element.getAttribute('data-line') || '0'); return offsetForLine(line); @@ -209,6 +210,6 @@ function mockOffsetProperties() { }); } -function offsetForLine(line: number) { +function offsetForLine(line: number): number { return line * 20; } diff --git a/packages/preview/src/browser/markdown/markdown-preview-handler.ts b/packages/preview/src/browser/markdown/markdown-preview-handler.ts index e19b20007d0d9..c3d5669caf746 100644 --- a/packages/preview/src/browser/markdown/markdown-preview-handler.ts +++ b/packages/preview/src/browser/markdown/markdown-preview-handler.ts @@ -101,7 +101,7 @@ export class MarkdownPreviewHandler implements PreviewHandler { return linkURI; } - protected revealFragment(contentElement: HTMLElement, fragment: string) { + protected revealFragment(contentElement: HTMLElement, fragment: string): void { const elementToReveal = this.findElementForFragment(contentElement, fragment); if (!elementToReveal) { return; diff --git a/packages/preview/src/browser/preview-contribution.ts b/packages/preview/src/browser/preview-contribution.ts index 2554b2f645358..7261ca9e647a7 100644 --- a/packages/preview/src/browser/preview-contribution.ts +++ b/packages/preview/src/browser/preview-contribution.ts @@ -71,7 +71,7 @@ export class PreviewContribution extends NavigatableWidgetOpenHandler { this.registerOpenOnDoubleClick(previewWidget); this.registerEditorAndPreviewSync(previewWidget); @@ -81,7 +81,7 @@ export class PreviewContribution extends NavigatableWidgetOpenHandler { this.scrollSyncLockOn = on; if (this.scrollSyncLockTimeout) { window.clearTimeout(this.scrollSyncLockTimeout); diff --git a/packages/preview/src/browser/preview-widget.ts b/packages/preview/src/browser/preview-widget.ts index 525375b86edd3..a8658ee1f92f5 100644 --- a/packages/preview/src/browser/preview-widget.ts +++ b/packages/preview/src/browser/preview-widget.ts @@ -26,6 +26,7 @@ import { ThemeService } from '@theia/core/lib/browser/theming'; import { EditorPreferences } from '@theia/editor/lib/browser'; import throttle = require('lodash.throttle'); +import { Disposable } from '@theia/core/lib/common/disposable'; export const PREVIEW_WIDGET_CLASS = 'theia-preview-widget'; @@ -112,7 +113,7 @@ export class PreviewWidget extends BaseWidget implements Navigatable { } protected preventScrollNotification: boolean = false; - protected startScrollSync() { + protected startScrollSync(): Disposable { return addEventListener(this.node, 'scroll', throttle((event: UIEvent) => { if (this.preventScrollNotification) { return; @@ -122,7 +123,7 @@ export class PreviewWidget extends BaseWidget implements Navigatable { }, 50)); } - protected startDoubleClickListener() { + protected startDoubleClickListener(): Disposable { return addEventListener(this.node, 'dblclick', (event: MouseEvent) => { if (!(event.target instanceof HTMLElement)) { return; @@ -163,7 +164,7 @@ export class PreviewWidget extends BaseWidget implements Navigatable { this.performUpdate(); } - protected forceUpdate() { + protected forceUpdate(): void { this.previousContent = ''; this.update(); } diff --git a/packages/process/src/node/multi-ring-buffer.spec.ts b/packages/process/src/node/multi-ring-buffer.spec.ts index 5b8bb2e47b375..6cf4692397d5f 100644 --- a/packages/process/src/node/multi-ring-buffer.spec.ts +++ b/packages/process/src/node/multi-ring-buffer.spec.ts @@ -19,9 +19,9 @@ import { MultiRingBuffer } from './multi-ring-buffer'; const expect = chai.expect; -describe('MultiRingBuffer', function () { +describe('MultiRingBuffer', function (): void { - it('expect buffer to be empty initialized', function () { + it('expect buffer to be empty initialized', function (): void { const size = 2; const compareTo = Buffer.from('0000', 'hex'); const ringBuffer = new MultiRingBuffer({ size }); @@ -29,7 +29,7 @@ describe('MultiRingBuffer', function () { expect(ringBuffer['buffer'].equals(compareTo)).to.be.true; }); - it('expect enq and deq a string with unicode characters > 1 byte and no wrap around', function () { + it('expect enq and deq a string with unicode characters > 1 byte and no wrap around', function (): void { const ringBufferSize = 15; const ringBuffer = new MultiRingBuffer({ size: ringBufferSize }); const buffer = '\u00bd + \u00bc = \u00be'; @@ -39,7 +39,7 @@ describe('MultiRingBuffer', function () { expect(ringBuffer.size()).to.be.equal(bufferByteLength); }); - it('expect enq and deq a string with unicode characters > 1 byte and wrap around', function () { + it('expect enq and deq a string with unicode characters > 1 byte and wrap around', function (): void { const buffer = '\u00bd + \u00bc = \u00be'; const ringBufferSize = Buffer.byteLength(buffer[buffer.length - 1]); const ringBuffer = new MultiRingBuffer({ size: ringBufferSize }); @@ -56,7 +56,7 @@ describe('MultiRingBuffer', function () { } }); - it('expect enq a string < ring buffer size ', function () { + it('expect enq a string < ring buffer size ', function (): void { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const buffer = 'test'; @@ -70,7 +70,7 @@ describe('MultiRingBuffer', function () { }); - it('expect deq a string < ring buffer size ', function () { + it('expect deq a string < ring buffer size ', function (): void { const ringBuffer = new MultiRingBuffer({ size: 5 }); const buffer = 'test'; @@ -84,7 +84,7 @@ describe('MultiRingBuffer', function () { }); - it('expect deq a string > ring buffer size ', function () { + it('expect deq a string > ring buffer size ', function (): void { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const buffer = 'testabcd'; @@ -99,7 +99,7 @@ describe('MultiRingBuffer', function () { }); - it('expect enq deq enq deq a string > ring buffer size ', function () { + it('expect enq deq enq deq a string > ring buffer size ', function (): void { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const buffer = '12345678'; @@ -117,7 +117,7 @@ describe('MultiRingBuffer', function () { } }); - it('expect enq a string == ring buffer size then one > ring buffer size and dequeue them ', function () { + it('expect enq a string == ring buffer size then one > ring buffer size and dequeue them ', function (): void { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const buffers = ['12345', '12345678']; @@ -140,7 +140,7 @@ describe('MultiRingBuffer', function () { expect(ringBuffer.sizeForReader(reader)).to.be.equal(0); }); - it('expect enq a string == ring buffer size then one < ring buffer size and dequeue them ', function () { + it('expect enq a string == ring buffer size then one < ring buffer size and dequeue them ', function (): void { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const buffers = ['12345', '123']; @@ -163,7 +163,7 @@ describe('MultiRingBuffer', function () { expect(ringBuffer.sizeForReader(reader)).to.be.equal(0); }); - it('expect enq a string == ring buffer size then one < ring buffer then one < buffer size and deque ', function () { + it('expect enq a string == ring buffer size then one < ring buffer then one < buffer size and deque ', function (): void { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const buffers = ['12345', '123', '678']; @@ -186,7 +186,7 @@ describe('MultiRingBuffer', function () { expect(ringBuffer.sizeForReader(reader)).to.be.equal(0); }); - it('expect enq buffer size then enq 1 to dequeue the right value', function () { + it('expect enq buffer size then enq 1 to dequeue the right value', function (): void { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const buffers = ['12345', '1']; @@ -209,7 +209,7 @@ describe('MultiRingBuffer', function () { expect(ringBuffer.sizeForReader(reader)).to.be.equal(0); }); - it('expect enq buffer size then enq 1 twice to dequeue the right value', function () { + it('expect enq buffer size then enq 1 twice to dequeue the right value', function (): void { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const buffers = ['12345', '1', '12345', '1']; @@ -232,7 +232,7 @@ describe('MultiRingBuffer', function () { expect(ringBuffer.sizeForReader(reader)).to.be.equal(0); }); - it('expect enq buffer size of various sizes dequeue the right value', function () { + it('expect enq buffer size of various sizes dequeue the right value', function (): void { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const buffers = ['12345', '123', '678', '12345', '1', '12345', '123', '12', '12', '1', '12', '123', '1234', '12345', '1', '12']; @@ -256,7 +256,7 @@ describe('MultiRingBuffer', function () { expect(ringBuffer.sizeForReader(reader)).to.be.equal(0); }); - it('expect enq buffer sizes < buffer size to dequeue normally', function () { + it('expect enq buffer sizes < buffer size to dequeue normally', function (): void { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const buffers = ['1', '1']; @@ -279,7 +279,7 @@ describe('MultiRingBuffer', function () { expect(ringBuffer.sizeForReader(reader)).to.be.equal(0); }); - it('expect enq buffer size of various sizes dequeue the right value', function () { + it('expect enq buffer size of various sizes dequeue the right value', function (): void { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const buffers = ['1', '1', '12', '12']; @@ -302,7 +302,7 @@ describe('MultiRingBuffer', function () { expect(ringBuffer.sizeForReader(reader)).to.be.equal(0); }); - it('expect multiple enq and deq to deq the right values', function () { + it('expect multiple enq and deq to deq the right values', function (): void { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); ringBuffer.enq('12345'); @@ -323,7 +323,7 @@ describe('MultiRingBuffer', function () { expect(ringBuffer.sizeForReader(reader)).to.be.equal(0); }); - it('expect data from stream on enq', async function () { + it('expect data from stream on enq', async function (): Promise { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const buffer = 'abc'; @@ -340,7 +340,7 @@ describe('MultiRingBuffer', function () { await p; }); - it('expect data from stream when data is already enqed', async function () { + it('expect data from stream when data is already enqed', async function (): Promise { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const buffer = 'abc'; @@ -357,7 +357,7 @@ describe('MultiRingBuffer', function () { await p; }); - it('expect disposing of a stream to delete it from the ringbuffer', function () { + it('expect disposing of a stream to delete it from the ringbuffer', function (): void { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const astream = ringBuffer.getStream(); @@ -366,7 +366,7 @@ describe('MultiRingBuffer', function () { expect(ringBuffer.readersSize()).to.be.equal(0); }); - it('expect disposing of a reader to delete it from the ringbuffer', function () { + it('expect disposing of a reader to delete it from the ringbuffer', function (): void { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const reader = ringBuffer.getReader(); @@ -374,7 +374,7 @@ describe('MultiRingBuffer', function () { expect(ringBuffer.readersSize()).to.be.equal(0); }); - it('expect enq a string in utf8 and get it in hex', function () { + it('expect enq a string in utf8 and get it in hex', function (): void { const ringBuffer = new MultiRingBuffer({ size: 5 }); const buffer = 'test'; @@ -385,7 +385,7 @@ describe('MultiRingBuffer', function () { expect(readBuffer).to.equal('74657374'); }); - it('expect enq a string in hex and get it in utf8', function () { + it('expect enq a string in hex and get it in utf8', function (): void { const ringBuffer = new MultiRingBuffer({ size: 5 }); const buffer = '74657374'; @@ -396,7 +396,7 @@ describe('MultiRingBuffer', function () { expect(readBuffer).to.equal('test'); }); - it('expect data from stream in hex when enq in uf8', async function () { + it('expect data from stream in hex when enq in uf8', async function (): Promise { const size = 5; const ringBuffer = new MultiRingBuffer({ size }); const buffer = 'test'; @@ -413,7 +413,7 @@ describe('MultiRingBuffer', function () { await p; }); - it('expect deq a string < ring buffer size with the internal encoding in hex ', function () { + it('expect deq a string < ring buffer size with the internal encoding in hex ', function (): void { const ringBuffer = new MultiRingBuffer({ size: 5, encoding: 'hex' }); const buffer = 'test'; @@ -427,7 +427,7 @@ describe('MultiRingBuffer', function () { }); - it('expect the ringbuffer to be empty if we enq an empty string', function () { + it('expect the ringbuffer to be empty if we enq an empty string', function (): void { const ringBuffer = new MultiRingBuffer({ size: 5 }); const buffer = ''; @@ -436,17 +436,17 @@ describe('MultiRingBuffer', function () { expect(ringBuffer.empty()).to.be.equal(true); }); - it('expect an invalid reader count to be zero', function () { + it('expect an invalid reader count to be zero', function (): void { const ringBuffer = new MultiRingBuffer({ size: 5 }); expect(ringBuffer.sizeForReader(1)).to.be.equal(0); }); - it('expect an invalid reader to be empty', function () { + it('expect an invalid reader to be empty', function (): void { const ringBuffer = new MultiRingBuffer({ size: 5 }); expect(ringBuffer.emptyForReader(1)).to.be.equal(true); }); - it('expect partially deq a string < ring buffer size ', function () { + it('expect partially deq a string < ring buffer size ', function (): void { const ringBuffer = new MultiRingBuffer({ size: 5 }); const buffer = 'test'; @@ -464,7 +464,7 @@ describe('MultiRingBuffer', function () { expect(readBuffer).to.equal('st'); }); - it('expect partially deq a string < ring buffer size then enq and deq again ', function () { + it('expect partially deq a string < ring buffer size then enq and deq again ', function (): void { const ringBuffer = new MultiRingBuffer({ size: 5 }); const buffer = 'test'; const secondBuffer = 'abcd'; diff --git a/packages/process/src/node/multi-ring-buffer.ts b/packages/process/src/node/multi-ring-buffer.ts index 6a118ce25ddb5..ccc7a1712ed5d 100644 --- a/packages/process/src/node/multi-ring-buffer.ts +++ b/packages/process/src/node/multi-ring-buffer.ts @@ -39,18 +39,18 @@ export class MultiRingBufferReadableStream extends stream.Readable implements Di this.setEncoding(encoding); } - _read(size: number) { + _read(size: number): void { this.more = true; this.deq(size); } - onData() { + onData(): void { if (this.more === true) { this.deq(-1); } } - deq(size: number) { + deq(size: number): void { if (this.disposed === true) { return; } @@ -65,7 +65,7 @@ export class MultiRingBufferReadableStream extends stream.Readable implements Di while (buffer !== undefined && this.more === true && this.disposed === false); } - dispose() { + dispose(): void { this.ringBuffer.closeStream(this); this.ringBuffer.closeReader(this.reader); this.disposed = true; @@ -146,12 +146,12 @@ export class MultiRingBuffer { this.onData(startHead); } - getReader() { + getReader(): number { this.readers.set(this.readerId, this.tail); return this.readerId++; } - closeReader(id: number) { + closeReader(id: number): void { this.readers.delete(id); } @@ -162,11 +162,11 @@ export class MultiRingBuffer { return astream; } - closeStream(astream: MultiRingBufferReadableStream) { + closeStream(astream: MultiRingBufferReadableStream): void { this.streams.delete(astream); } - protected onData(start: number) { + protected onData(start: number): void { /* Any stream that has read everything already * Should go back to the last buffer in start offset */ for (const [id, pos] of this.readers) { @@ -219,7 +219,7 @@ export class MultiRingBuffer { return buffer; } - sizeForReader(id: number) { + sizeForReader(id: number): number { const pos = this.readers.get(id); if (pos === undefined) { return 0; @@ -228,18 +228,18 @@ export class MultiRingBuffer { return this.sizeFrom(pos, this.head, this.isWrapped(pos, this.head)); } - size() { + size(): number { return this.sizeFrom(this.tail, this.head, this.isWrapped(this.tail, this.head)); } - protected isWrapped(from: number, to: number) { + protected isWrapped(from: number, to: number): boolean { if (to < from) { return true; } else { return false; } } - protected sizeFrom(from: number, to: number, wrap: boolean) { + protected sizeFrom(from: number, to: number, wrap: boolean): number { if (from === -1 || to === -1) { return 0; } else { @@ -251,7 +251,7 @@ export class MultiRingBuffer { } } - emptyForReader(id: number) { + emptyForReader(id: number): boolean { const pos = this.readers.get(id); if (pos === undefined || pos === -1) { return true; @@ -277,7 +277,7 @@ export class MultiRingBuffer { } /* Position should be incremented if it goes pass end. */ - protected shouldIncPos(pos: number, end: number, size: number) { + protected shouldIncPos(pos: number, end: number, size: number): boolean { const { newPos: newHead, wrap } = this.inc(end, size); /* Tail Head */ @@ -311,7 +311,7 @@ export class MultiRingBuffer { } /* Increment the main tail and all the reader positions. */ - protected incTails(size: number) { + protected incTails(size: number): void { this.tail = this.incTail(this.tail, size).newPos; for (const [id, pos] of this.readers) { diff --git a/packages/process/src/node/process.ts b/packages/process/src/node/process.ts index 668132c3d3fa9..14c9873ae2b41 100644 --- a/packages/process/src/node/process.ts +++ b/packages/process/src/node/process.ts @@ -120,7 +120,7 @@ export abstract class Process { abstract kill(signal?: string): void; - get killed() { + get killed(): boolean { return this._killed; } @@ -136,7 +136,7 @@ export abstract class Process { return this.errorEmitter.event; } - protected emitOnStarted() { + protected emitOnStarted(): void { this.startEmitter.fire({}); } @@ -144,13 +144,13 @@ export abstract class Process { * Emit the onExit event for this process. Only one of code and signal * should be defined. */ - protected emitOnExit(code?: number, signal?: string) { + protected emitOnExit(code?: number, signal?: string): void { const exitEvent: IProcessExitEvent = { code, signal }; this.handleOnExit(exitEvent); this.exitEmitter.fire(exitEvent); } - protected handleOnExit(event: IProcessExitEvent) { + protected handleOnExit(event: IProcessExitEvent): void { this._killed = true; const signalSuffix = event.signal ? `, signal: ${event.signal}` : ''; const executable = this.isForkOptions(this.options) ? this.options.modulePath : this.options.command; @@ -159,16 +159,16 @@ export abstract class Process { executable, this.options.args); } - protected emitOnError(err: ProcessErrorEvent) { + protected emitOnError(err: ProcessErrorEvent): void { this.handleOnError(err); this.errorEmitter.fire(err); } - protected async emitOnErrorAsync(error: ProcessErrorEvent) { + protected async emitOnErrorAsync(error: ProcessErrorEvent): Promise { process.nextTick(this.emitOnError.bind(this), error); } - protected handleOnError(error: ProcessErrorEvent) { + protected handleOnError(error: ProcessErrorEvent): void { this._killed = true; this.logger.error(error); } diff --git a/packages/process/src/node/raw-process.spec.ts b/packages/process/src/node/raw-process.spec.ts index a83a0ef7a38ca..99ab53e187582 100644 --- a/packages/process/src/node/raw-process.spec.ts +++ b/packages/process/src/node/raw-process.spec.ts @@ -34,7 +34,7 @@ const track = temp.track(); const expect = chai.expect; const FORK_TEST_FILE = path.join(__dirname, '../../src/node/test/process-fork-test.js'); -describe('RawProcess', function () { +describe('RawProcess', function (): void { this.timeout(20_000); @@ -48,7 +48,7 @@ describe('RawProcess', function () { track.cleanupSync(); }); - it('test error on non-existent path', async function () { + it('test error on non-existent path', async function (): Promise { const error = await new Promise((resolve, reject) => { const proc = rawProcessFactory({ command: '/non-existent' }); proc.onStart(reject); @@ -59,7 +59,7 @@ describe('RawProcess', function () { expect(error.code).eq('ENOENT'); }); - it('test error on non-executable path', async function () { + it('test error on non-executable path', async function (): Promise { // Create a non-executable file. const f = track.openSync('non-executable'); fs.writeSync(f.fd, 'echo bob'); @@ -86,7 +86,7 @@ describe('RawProcess', function () { expect(error.code).eq(expectedCode); }); - it('test start event', function () { + it('test start event', function (): Promise { return new Promise(async (resolve, reject) => { const args = ['-e', 'process.exit(3)']; const rawProcess = rawProcessFactory({ command: process.execPath, 'args': args }); @@ -96,7 +96,7 @@ describe('RawProcess', function () { }); }); - it('test exit', async function () { + it('test exit', async function (): Promise { const args = ['--version']; const rawProcess = rawProcessFactory({ command: process.execPath, 'args': args }); const p = new Promise((resolve, reject) => { @@ -117,7 +117,7 @@ describe('RawProcess', function () { expect(exitCode).equal(0); }); - it('test pipe stdout stream', async function () { + it('test pipe stdout stream', async function (): Promise { const output = await new Promise(async (resolve, reject) => { const args = ['-e', 'console.log("text to stdout")']; const outStream = new stream.PassThrough(); @@ -138,7 +138,7 @@ describe('RawProcess', function () { expect(output).to.be.equal('text to stdout'); }); - it('test pipe stderr stream', async function () { + it('test pipe stderr stream', async function (): Promise { const output = await new Promise(async (resolve, reject) => { const args = ['-e', 'console.error("text to stderr")']; const outStream = new stream.PassThrough(); @@ -159,7 +159,7 @@ describe('RawProcess', function () { expect(output).to.be.equal('text to stderr'); }); - it('test forked pipe stdout stream', async function () { + it('test forked pipe stdout stream', async function (): Promise { const args = ['version']; const rawProcess = rawProcessFactory({ modulePath: FORK_TEST_FILE, args, options: { stdio: 'pipe' } }); @@ -180,7 +180,7 @@ describe('RawProcess', function () { expect(await p).to.be.equal('1.0.0'); }); - it('test forked pipe stderr stream', async function () { + it('test forked pipe stderr stream', async function (): Promise { const rawProcess = rawProcessFactory({ modulePath: FORK_TEST_FILE, args: [], options: { stdio: 'pipe' } }); const outStream = new stream.PassThrough(); diff --git a/packages/process/src/node/raw-process.ts b/packages/process/src/node/raw-process.ts index 0f53f3db120e6..da58a6ab1773a 100644 --- a/packages/process/src/node/raw-process.ts +++ b/packages/process/src/node/raw-process.ts @@ -143,14 +143,14 @@ export class RawProcess extends Process { } } - get pid() { + get pid(): number { if (!this.process) { throw new Error('process did not start correctly'); } return this.process.pid; } - kill(signal?: string) { + kill(signal?: string): void { if (this.process && this.killed === false) { this.process.kill(signal); } diff --git a/packages/process/src/node/terminal-process.spec.ts b/packages/process/src/node/terminal-process.spec.ts index 548dc0d951a87..8caa9dfe0c4c0 100644 --- a/packages/process/src/node/terminal-process.spec.ts +++ b/packages/process/src/node/terminal-process.spec.ts @@ -33,11 +33,11 @@ beforeEach(() => { terminalProcessFactory = createProcessTestContainer().get(TerminalProcessFactory); }); -describe('TerminalProcess', function () { +describe('TerminalProcess', function (): void { this.timeout(20_000); - it('test error on non existent path', async function () { + it('test error on non existent path', async function (): Promise { const error = await new Promise((resolve, reject) => { const proc = terminalProcessFactory({ command: '/non-existent' }); proc.onStart(reject); @@ -48,7 +48,7 @@ describe('TerminalProcess', function () { expect(error.code).eq('ENOENT'); }); - it('test error on trying to execute a directory', async function () { + it('test error on trying to execute a directory', async function (): Promise { const error = await new Promise((resolve, reject) => { const proc = terminalProcessFactory({ command: __dirname }); proc.onStart(reject); @@ -66,7 +66,7 @@ describe('TerminalProcess', function () { } }); - it('test exit', async function () { + it('test exit', async function (): Promise { const args = ['--version']; const exit = await new Promise((resolve, reject) => { const proc = terminalProcessFactory({ command: process.execPath, args }); @@ -77,7 +77,7 @@ describe('TerminalProcess', function () { expect(exit.code).eq(0); }); - it('test pipe stream', async function () { + it('test pipe stream', async function (): Promise { const v = await new Promise((resolve, reject) => { const args = ['--version']; const terminalProcess = terminalProcessFactory({ command: process.execPath, args }); @@ -113,7 +113,7 @@ describe('TerminalProcess', function () { */ if (process.platform !== 'win32' || process.env.THEIA_PROCESS_TEST_OVERRIDE) { - describe('TerminalProcess { shell: true }', function () { + describe('TerminalProcess { shell: true }', function (): void { this.timeout(20_000); @@ -136,37 +136,37 @@ if (process.platform !== 'win32' || process.env.THEIA_PROCESS_TEST_OVERRIDE) { }); } - it('should execute the command as a whole if not arguments are specified', async function () { + it('should execute the command as a whole if not arguments are specified', async function (): Promise { const proc = terminalProcessFactory({ command: 'echo a b c', options: { shell: true } }); const exit = await checkOutput(proc, /^a b c/); expect(exit.code).eq(0); }); - it('should fail if user defines a full command line and arguments', async function () { + it('should fail if user defines a full command line and arguments', async function (): Promise { const proc = terminalProcessFactory({ command: 'echo a b c', args: [], options: { shell: true } }); const exit = await checkOutput(proc); expect(exit.code).not.eq(0); }); - it('should be able to exec using simple arguments', async function () { + it('should be able to exec using simple arguments', async function (): Promise { const proc = terminalProcessFactory({ command: 'echo', args: ['a', 'b', 'c'], options: { shell: true } }); const exit = await checkOutput(proc, /^a b c/); expect(exit.code).eq(0); }); - it('should be able to run using arguments containing whitespace', async function () { + it('should be able to run using arguments containing whitespace', async function (): Promise { const proc = terminalProcessFactory({ command: 'echo', args: ['a', 'b', ' c'], options: { shell: true } }); const exit = await checkOutput(proc, /^a b c/); expect(exit.code).eq(0); }); - it('will fail if user specify problematic arguments', async function () { + it('will fail if user specify problematic arguments', async function (): Promise { const proc = terminalProcessFactory({ command: 'echo', args: ['a', 'b', 'c"'], options: { shell: true } }); const exit = await checkOutput(proc); expect(exit.code).not.eq(0); }); - it('should be able to run using arguments specifying which quoting method to use', async function () { + it('should be able to run using arguments specifying which quoting method to use', async function (): Promise { const proc = terminalProcessFactory({ command: 'echo', args: ['a', 'b', { value: 'c"', quoting: 'escaped' }], options: { shell: true } }); const exit = await checkOutput(proc, /^a b c"/); expect(exit.code).eq(0); diff --git a/packages/process/src/node/terminal-process.ts b/packages/process/src/node/terminal-process.ts index fe663386006df..d243638e19dd7 100644 --- a/packages/process/src/node/terminal-process.ts +++ b/packages/process/src/node/terminal-process.ts @@ -260,12 +260,12 @@ export class TerminalProcess extends Process { return this.ringBuffer.getStream(); } - get pid() { + get pid(): number { this.checkTerminal(); return this.terminal!.pid; } - kill(signal?: string) { + kill(signal?: string): void { if (this.terminal && this.killed === false) { this.terminal.kill(signal); } diff --git a/packages/process/src/node/test/process-test-container.ts b/packages/process/src/node/test/process-test-container.ts index c07788feed74f..904729d100d68 100644 --- a/packages/process/src/node/test/process-test-container.ts +++ b/packages/process/src/node/test/process-test-container.ts @@ -17,7 +17,7 @@ import { Container } from 'inversify'; import { bindLogger } from '@theia/core/lib/node/logger-backend-module'; import processBackendModule from '../process-backend-module'; -export function createProcessTestContainer() { +export function createProcessTestContainer(): Container { const testContainer = new Container(); bindLogger(testContainer.bind.bind(testContainer)); diff --git a/packages/python/src/browser/python-client-contribution.ts b/packages/python/src/browser/python-client-contribution.ts index a6f1b1736adf1..04d453ae0f569 100644 --- a/packages/python/src/browser/python-client-contribution.ts +++ b/packages/python/src/browser/python-client-contribution.ts @@ -32,7 +32,7 @@ export class PythonClientContribution extends BaseLanguageClientContribution { super(workspace, languages, languageClientFactory); } - protected get globPatterns() { + protected get globPatterns(): string[] { return [ '**/*.py' ]; diff --git a/packages/scm/src/browser/decorations/scm-decorations-service.ts b/packages/scm/src/browser/decorations/scm-decorations-service.ts index 4cac26f2371d5..b35792b853a05 100644 --- a/packages/scm/src/browser/decorations/scm-decorations-service.ts +++ b/packages/scm/src/browser/decorations/scm-decorations-service.ts @@ -65,7 +65,7 @@ export class ScmDecorationsService { }); } - async applyEditorDecorations(editor: TextEditor) { + async applyEditorDecorations(editor: TextEditor): Promise { const currentRepo = this.scmService.selectedRepository; if (currentRepo) { try { diff --git a/packages/scm/src/browser/dirty-diff/content-lines.ts b/packages/scm/src/browser/dirty-diff/content-lines.ts index ff3369e3268ff..a9f0de73b068c 100644 --- a/packages/scm/src/browser/dirty-diff/content-lines.ts +++ b/packages/scm/src/browser/dirty-diff/content-lines.ts @@ -71,7 +71,8 @@ export namespace ContentLines { function getProxyHandler(): ProxyHandler { return { - get(target: ContentLines, p: PropertyKey) { + // tslint:disable-next-line:no-any + get(target: ContentLines, p: PropertyKey): any { switch (p) { case 'prototype': return undefined; @@ -85,7 +86,7 @@ export namespace ContentLines { return [0, target.length - 1]; }; case Symbol.iterator: - return function* () { + return function* (): IterableIterator { for (let i = 0; i < target.length; i++) { yield target.getLineContent(i); } diff --git a/packages/scm/src/browser/dirty-diff/diff-computer.spec.ts b/packages/scm/src/browser/dirty-diff/diff-computer.spec.ts index 3392247b234c4..877a4c7f45cc8 100644 --- a/packages/scm/src/browser/dirty-diff/diff-computer.spec.ts +++ b/packages/scm/src/browser/dirty-diff/diff-computer.spec.ts @@ -350,7 +350,7 @@ describe('dirty-diff-computer', () => { }); -function computeDirtyDiff(previous: string[], modified: string[]) { +function computeDirtyDiff(previous: string[], modified: string[]): DirtyDiff { const a = ContentLines.arrayLike({ length: previous.length, getLineContent: line => { diff --git a/packages/scm/src/browser/dirty-diff/diff-computer.ts b/packages/scm/src/browser/dirty-diff/diff-computer.ts index cb8a5f1fd9227..a5172499c5953 100644 --- a/packages/scm/src/browser/dirty-diff/diff-computer.ts +++ b/packages/scm/src/browser/dirty-diff/diff-computer.ts @@ -77,15 +77,15 @@ export class DiffComputer { class ArrayDiff extends jsdiff.Diff { // tslint:disable-next-line:no-any - tokenize(value: any) { + tokenize(value: any): any { return value; } // tslint:disable-next-line:no-any - join(value: any) { + join(value: any): any { return value; } // tslint:disable-next-line:no-any - removeEmpty(value: any) { + removeEmpty(value: any): any { return value; } } diff --git a/packages/scm/src/browser/dirty-diff/dirty-diff-module.ts b/packages/scm/src/browser/dirty-diff/dirty-diff-module.ts index 2a3df5ac284e0..ab56588eee9df 100644 --- a/packages/scm/src/browser/dirty-diff/dirty-diff-module.ts +++ b/packages/scm/src/browser/dirty-diff/dirty-diff-module.ts @@ -19,6 +19,6 @@ import { DirtyDiffDecorator } from './dirty-diff-decorator'; import '../../../src/browser/style/dirty-diff.css'; -export function bindDirtyDiff(bind: interfaces.Bind) { +export function bindDirtyDiff(bind: interfaces.Bind): void { bind(DirtyDiffDecorator).toSelf().inSingletonScope(); } diff --git a/packages/scm/src/browser/scm-amend-component.tsx b/packages/scm/src/browser/scm-amend-component.tsx index a7d375c1c3ade..bb46af0cc4236 100644 --- a/packages/scm/src/browser/scm-amend-component.tsx +++ b/packages/scm/src/browser/scm-amend-component.tsx @@ -84,7 +84,7 @@ export class ScmAmendComponent extends React.Component { const lastCommit = await this.getLastCommit(); this.setState({ amendingCommits: await this.buildAmendingList(lastCommit ? lastCommit.commit : undefined), lastCommit }); @@ -93,11 +93,11 @@ export class ScmAmendComponent extends React.Component { const nextCommit = await this.getLastCommit(); if (nextCommit && this.state.lastCommit && nextCommit.commit.id === this.state.lastCommit.commit.id) { // No change here @@ -243,7 +243,7 @@ export class ScmAmendComponent extends React.Component window.requestAnimationFrame(callback), 0); @@ -409,7 +409,7 @@ export class ScmAmendComponent extends React.Component; } - protected renderCommitBeingAmended(commitData: { commit: ScmCommit, avatar: string }, isOldestAmendCommit: boolean) { + protected renderCommitBeingAmended(commitData: { commit: ScmCommit, avatar: string }, isOldestAmendCommit: boolean): JSX.Element { if (isOldestAmendCommit && this.state.transition.state !== 'none' && this.state.transition.direction === 'up') { return
@@ -541,7 +541,7 @@ export class ScmAmendComponent extends React.Component this.doUnamendAll(); - protected async doUnamendAll() { + protected async doUnamendAll(): Promise { while (this.state.amendingCommits.length > 0) { this.unamend(); await new Promise(resolve => setTimeout(resolve, TRANSITION_TIME_MS)); @@ -549,7 +549,7 @@ export class ScmAmendComponent extends React.Component this.doClearAmending(); - protected async doClearAmending() { + protected async doClearAmending(): Promise { await this.clearAmendingCommits(); this.setState({ amendingCommits: [] }); } diff --git a/packages/scm/src/browser/scm-widget.tsx b/packages/scm/src/browser/scm-widget.tsx index 36bfb8e62ae5e..63635f1be4df7 100644 --- a/packages/scm/src/browser/scm-widget.tsx +++ b/packages/scm/src/browser/scm-widget.tsx @@ -434,7 +434,7 @@ export namespace ScmElement { export class ScmResourceComponent extends ScmElement { - render() { + render(): JSX.Element | undefined { const { hover } = this.state; const { name, repository, resource, labelProvider, commands, menus, contextKeys } = this.props; const rootUri = resource.group.provider.rootUri; @@ -494,7 +494,7 @@ export namespace ScmResourceComponent { } export class ScmResourceGroupsContainer extends React.Component { - render() { + render(): JSX.Element { const { groups } = this.props.repository.provider; return
; } - componentDidMount() { + componentDidMount(): void { this.props.addScmListKeyListeners(this.props.id); } } @@ -539,7 +539,7 @@ export namespace ScmResourceGroupsContainer { export class ScmResourceGroupContainer extends ScmElement { - render() { + render(): JSX.Element { const { hover } = this.state; const { group, menus, commands, contextKeys } = this.props; return
diff --git a/packages/search-in-workspace/src/browser/search-in-workspace-result-tree-widget.tsx b/packages/search-in-workspace/src/browser/search-in-workspace-result-tree-widget.tsx index fc318a4f07a02..654c3566d41d7 100644 --- a/packages/search-in-workspace/src/browser/search-in-workspace-result-tree-widget.tsx +++ b/packages/search-in-workspace/src/browser/search-in-workspace-result-tree-widget.tsx @@ -145,7 +145,7 @@ export class SearchInWorkspaceResultTreeWidget extends TreeWidget { } @postConstruct() - protected init() { + protected init(): void { super.init(); this.addClass('resultContainer'); @@ -187,7 +187,7 @@ export class SearchInWorkspaceResultTreeWidget extends TreeWidget { return this.focusInputEmitter.event; } - collapseAll() { + collapseAll(): void { this.resultTree.forEach(rootFolderNode => { rootFolderNode.children.forEach(fileNode => this.expansionService.collapseNode(fileNode)); if (rootFolderNode.visible) { @@ -263,7 +263,7 @@ export class SearchInWorkspaceResultTreeWidget extends TreeWidget { }); } - focusFirstResult() { + focusFirstResult(): void { if (SearchInWorkspaceRoot.is(this.model.root) && this.model.root.children.length > 0) { const node = this.model.root.children[0]; if (SelectableTreeNode.is(node)) { @@ -304,7 +304,7 @@ export class SearchInWorkspaceResultTreeWidget extends TreeWidget { } } - protected updateCurrentEditorDecorations() { + protected updateCurrentEditorDecorations(): void { this.shell.allTabBars.map(tb => { const currentTitle = tb.currentTitle; if (currentTitle && currentTitle.owner instanceof EditorWidget) { @@ -416,7 +416,7 @@ export class SearchInWorkspaceResultTreeWidget extends TreeWidget {
; } - protected doReplace(node: TreeNode, e: React.MouseEvent) { + protected doReplace(node: TreeNode, e: React.MouseEvent): void { this.replace(node); e.stopPropagation(); } @@ -476,7 +476,7 @@ export class SearchInWorkspaceResultTreeWidget extends TreeWidget { }).open(); } - protected updateRightResults(node: SearchInWorkspaceResultLineNode) { + protected updateRightResults(node: SearchInWorkspaceResultLineNode): void { const fileNode = node.parent; const rightPositionedNodes = fileNode.children.filter(rl => rl.line === node.line && rl.character > node.character); const diff = this._replaceTerm.length - this.searchTerm.length; @@ -535,7 +535,7 @@ export class SearchInWorkspaceResultTreeWidget extends TreeWidget { } protected readonly remove = (node: TreeNode, e: React.MouseEvent) => this.doRemove(node, e); - protected doRemove(node: TreeNode, e: React.MouseEvent) { + protected doRemove(node: TreeNode, e: React.MouseEvent): void { this.removeNode(node); e.stopPropagation(); } @@ -716,7 +716,7 @@ export class SearchInWorkspaceResultTreeWidget extends TreeWidget { return fileUri.withScheme(MEMORY_TEXT).withQuery(lines.join('\n')); } - protected decorateEditor(node: SearchInWorkspaceFileNode | undefined, editorWidget: EditorWidget) { + protected decorateEditor(node: SearchInWorkspaceFileNode | undefined, editorWidget: EditorWidget): void { if (!DiffUris.isDiffUri(editorWidget.editor.uri)) { const key = `${editorWidget.editor.uri.toString()}#search-in-workspace-matches`; const oldDecorations = this.appliedDecorations.get(key) || []; diff --git a/packages/search-in-workspace/src/browser/search-in-workspace-service.ts b/packages/search-in-workspace/src/browser/search-in-workspace-service.ts index 59bf702c1eb7a..45d28cbc6b4be 100644 --- a/packages/search-in-workspace/src/browser/search-in-workspace-service.ts +++ b/packages/search-in-workspace/src/browser/search-in-workspace-service.ts @@ -36,7 +36,7 @@ export class SearchInWorkspaceClientImpl implements SearchInWorkspaceClient { this.service.onDone(searchId, error); } - setService(service: SearchInWorkspaceClient) { + setService(service: SearchInWorkspaceClient): void { this.service = service; } } @@ -70,7 +70,7 @@ export class SearchInWorkspaceService implements SearchInWorkspaceClient { @inject(ILogger) protected readonly logger: ILogger; @postConstruct() - protected init() { + protected init(): void { this.client.setService(this); } @@ -133,7 +133,7 @@ export class SearchInWorkspaceService implements SearchInWorkspaceClient { } // Cancel an ongoing search. - cancel(searchId: number) { + cancel(searchId: number): void { this.pendingSearches.delete(searchId); this.searchServer.cancel(searchId); } diff --git a/packages/search-in-workspace/src/browser/search-in-workspace-widget.tsx b/packages/search-in-workspace/src/browser/search-in-workspace-widget.tsx index ee274d2e00d05..e4e41de87e9e6 100644 --- a/packages/search-in-workspace/src/browser/search-in-workspace-widget.tsx +++ b/packages/search-in-workspace/src/browser/search-in-workspace-widget.tsx @@ -276,7 +276,7 @@ export class SearchInWorkspaceWidget extends BaseWidget implements StatefulWidge this.focusInputField(); } - protected focusInputField() { + protected focusInputField(): void { const f = document.getElementById('search-input-field'); if (f) { (f as HTMLInputElement).focus(); @@ -337,18 +337,18 @@ export class SearchInWorkspaceWidget extends BaseWidget implements StatefulWidge } protected readonly focusSearchFieldContainer = () => this.doFocusSearchFieldContainer(); - protected doFocusSearchFieldContainer() { + protected doFocusSearchFieldContainer(): void { this.searchFieldContainerIsFocused = true; this.update(); } protected readonly unfocusSearchFieldContainer = () => this.doUnfocusSearchFieldContainer(); - protected doUnfocusSearchFieldContainer() { + protected doUnfocusSearchFieldContainer(): void { this.searchFieldContainerIsFocused = false; this.update(); } protected readonly search = (e: React.KeyboardEvent) => this.doSearch(e); - protected doSearch(e: React.KeyboardEvent) { + protected doSearch(e: React.KeyboardEvent): void { if (e.target) { if (Key.ARROW_DOWN.keyCode === e.keyCode) { this.resultTreeWidget.focusFirstResult(); @@ -388,7 +388,7 @@ export class SearchInWorkspaceWidget extends BaseWidget implements StatefulWidge protected handleBlurSearchInputBox = () => this.contextKeyService.setSearchInputBoxFocus(false); protected readonly updateReplaceTerm = (e: React.KeyboardEvent) => this.doUpdateReplaceTerm(e); - protected doUpdateReplaceTerm(e: React.KeyboardEvent) { + protected doUpdateReplaceTerm(e: React.KeyboardEvent): void { if (e.target) { this.replaceTerm = (e.target as HTMLInputElement).value; this.resultTreeWidget.replaceTerm = this.replaceTerm; @@ -457,7 +457,7 @@ export class SearchInWorkspaceWidget extends BaseWidget implements StatefulWidge this.update(); } - protected updateSearchOptions() { + protected updateSearchOptions(): void { this.searchInWorkspaceOptions.matchCase = this.matchCaseState.enabled; this.searchInWorkspaceOptions.matchWholeWord = this.wholeWordState.enabled; this.searchInWorkspaceOptions.useRegExp = this.regExpState.enabled; diff --git a/packages/search-in-workspace/src/common/search-in-workspace-interface.ts b/packages/search-in-workspace/src/common/search-in-workspace-interface.ts index d6eec99d73e93..0a0307f6e806a 100644 --- a/packages/search-in-workspace/src/common/search-in-workspace-interface.ts +++ b/packages/search-in-workspace/src/common/search-in-workspace-interface.ts @@ -86,7 +86,7 @@ export namespace SearchInWorkspaceResult { * Sort search in workspace results according to file, line, character position * and then length. */ - export function compare(a: SearchInWorkspaceResult, b: SearchInWorkspaceResult) { + export function compare(a: SearchInWorkspaceResult, b: SearchInWorkspaceResult): number { if (a.fileUri !== b.fileUri) { return a.fileUri < b.fileUri ? -1 : 1; } diff --git a/packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.slow-spec.ts b/packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.slow-spec.ts index c590710defea6..dea08ee338cce 100644 --- a/packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.slow-spec.ts +++ b/packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.slow-spec.ts @@ -66,7 +66,7 @@ class ResultAccumulator implements SearchInWorkspaceClient { } // Create a test file relative to rootDir. -function createTestFile(filename: string, text: string) { +function createTestFile(filename: string, text: string): void { const dir = getRootPathFromName(filename); fs.writeFileSync(path.join(dir, filename), text); fileLines.set(filename, text.split('\n')); @@ -204,7 +204,7 @@ after(() => { // The expected entries should also have the file field set relatively to // rootDir. This function will update the field to contain the absolute path. -function compareSearchResults(expected: SearchInWorkspaceResult[], actual: SearchInWorkspaceResult[]) { +function compareSearchResults(expected: SearchInWorkspaceResult[], actual: SearchInWorkspaceResult[]): void { expect(actual.length).eq(expected.length); if (actual.length !== expected.length) { @@ -228,7 +228,7 @@ function compareSearchResults(expected: SearchInWorkspaceResult[], actual: Searc } } -describe('ripgrep-search-in-workspace-server', function () { +describe('ripgrep-search-in-workspace-server', function (): void { this.timeout(10000); // Try some simple patterns with different case. @@ -715,7 +715,7 @@ describe('ripgrep-search-in-workspace-server', function () { ripgrepServer.search(pattern, [rootDirAUri, rootSubdirAUri]); }); - it('fails gracefully when rg isn\'t found', async function () { + it('fails gracefully when rg isn\'t found', async function (): Promise { const errorString = await new Promise((resolve, reject) => { const rgServer = createInstance('/non-existent/rg'); @@ -733,7 +733,7 @@ describe('ripgrep-search-in-workspace-server', function () { expect(errorString).contains('could not find the ripgrep (rg) binary'); }); - it('fails gracefully when rg isn\'t executable', async function () { + it('fails gracefully when rg isn\'t executable', async function (): Promise { const errorString = await new Promise((resolve, reject) => { // Create temporary file, ensure it is not executable. const rg = temp.openSync(); diff --git a/packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts b/packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts index ecd84326323e5..67b3f81466ecf 100644 --- a/packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts +++ b/packages/search-in-workspace/src/node/ripgrep-search-in-workspace-server.ts @@ -269,7 +269,7 @@ export class RipgrepSearchInWorkspaceServer implements SearchInWorkspaceServer { } // Send onDone to the client and clean up what we know about search searchId. - private wrapUpSearch(searchId: number, error?: string) { + private wrapUpSearch(searchId: number, error?: string): void { if (this.ongoingSearches.delete(searchId)) { if (this.client) { this.logger.debug('Sending onDone for ' + searchId, error); diff --git a/packages/task/src/browser/process/process-task-frontend-module.ts b/packages/task/src/browser/process/process-task-frontend-module.ts index 39a785134a255..7cd35f495b4da 100644 --- a/packages/task/src/browser/process/process-task-frontend-module.ts +++ b/packages/task/src/browser/process/process-task-frontend-module.ts @@ -19,7 +19,7 @@ import { ProcessTaskContribution } from './process-task-contribution'; import { ProcessTaskResolver } from './process-task-resolver'; import { TaskContribution } from '../task-contribution'; -export function bindProcessTaskModule(bind: interfaces.Bind) { +export function bindProcessTaskModule(bind: interfaces.Bind): void { bind(ProcessTaskResolver).toSelf().inSingletonScope(); bind(ProcessTaskContribution).toSelf().inSingletonScope(); diff --git a/packages/task/src/browser/task-configurations.ts b/packages/task/src/browser/task-configurations.ts index ebec9a66f6be2..7cfad6eac0068 100644 --- a/packages/task/src/browser/task-configurations.ts +++ b/packages/task/src/browser/task-configurations.ts @@ -108,11 +108,11 @@ export class TaskConfigurations implements Disposable { })); } - setClient(client: TaskConfigurationClient) { + setClient(client: TaskConfigurationClient): void { this.client = client; } - dispose() { + dispose(): void { this.toDispose.dispose(); } @@ -195,7 +195,7 @@ export class TaskConfigurations implements Disposable { } /** removes tasks configured in the given task config file */ - removeTasks(configFileUri: string) { + removeTasks(configFileUri: string): void { const source = this.getSourceFolderFromConfigUri(configFileUri); this.tasksMap.delete(source); } @@ -204,7 +204,7 @@ export class TaskConfigurations implements Disposable { * Removes task customization objects found in the given task config file from the memory. * Please note: this function does not modify the task config file. */ - removeTaskCustomizations(configFileUri: string) { + removeTaskCustomizations(configFileUri: string): void { const source = this.getSourceFolderFromConfigUri(configFileUri); this.taskCustomizationMap.delete(source); } @@ -275,7 +275,7 @@ export class TaskConfigurations implements Disposable { * Tries to read the tasks from a config file and if it successes then updates the list of available tasks. * If reading a config file wasn't successful then does nothing. */ - protected async refreshTasks(configFileUri: string) { + protected async refreshTasks(configFileUri: string): Promise { const tasksArray = await this.readTasks(configFileUri); if (tasksArray) { const configuredTasksArray: TaskConfiguration[] = []; diff --git a/packages/task/src/browser/task-problem-matcher-registry.ts b/packages/task/src/browser/task-problem-matcher-registry.ts index 6c95f327f8a8f..c73e73ed81c33 100644 --- a/packages/task/src/browser/task-problem-matcher-registry.ts +++ b/packages/task/src/browser/task-problem-matcher-registry.ts @@ -36,7 +36,7 @@ export class ProblemMatcherRegistry { protected readonly problemPatternRegistry: ProblemPatternRegistry; @postConstruct() - protected init() { + protected init(): void { // tslint:disable-next-line:no-null-keyword this.matchers = Object.create(null); this.problemPatternRegistry.onReady().then(() => { diff --git a/packages/task/src/browser/task-problem-pattern-registry.ts b/packages/task/src/browser/task-problem-pattern-registry.ts index 8d94cc8d97313..72cf4d2550833 100644 --- a/packages/task/src/browser/task-problem-pattern-registry.ts +++ b/packages/task/src/browser/task-problem-pattern-registry.ts @@ -28,7 +28,7 @@ export class ProblemPatternRegistry { private readyPromise: Promise; @postConstruct() - protected init() { + protected init(): void { // tslint:disable-next-line:no-null-keyword this.patterns = Object.create(null); this.fillDefaults(); diff --git a/packages/task/src/browser/task-service.ts b/packages/task/src/browser/task-service.ts index 587d746347f2d..f98f6164ee02e 100644 --- a/packages/task/src/browser/task-service.ts +++ b/packages/task/src/browser/task-service.ts @@ -469,7 +469,7 @@ export class TaskService implements TaskConfigurationClient { return false; } - taskConfigurationChanged(event: string[]) { + taskConfigurationChanged(event: string[]): void { // do nothing for now } diff --git a/packages/task/src/common/task-common-module.ts b/packages/task/src/common/task-common-module.ts index d1ddafb12ac9e..6b34dda687cb4 100644 --- a/packages/task/src/common/task-common-module.ts +++ b/packages/task/src/common/task-common-module.ts @@ -23,7 +23,7 @@ import { TaskWatcher } from './task-watcher'; * * @param bind The bind function from inversify. */ -export function createCommonBindings(bind: interfaces.Bind) { +export function createCommonBindings(bind: interfaces.Bind): void { bind(ILogger).toDynamicValue(ctx => { const logger = ctx.container.get(ILogger); diff --git a/packages/task/src/common/task-watcher.ts b/packages/task/src/common/task-watcher.ts index 720b2b8a364ec..cb04340fa493c 100644 --- a/packages/task/src/common/task-watcher.ts +++ b/packages/task/src/common/task-watcher.ts @@ -28,19 +28,19 @@ export class TaskWatcher { const taskProcessEndedEmitter = this.onDidEndTaskProcessEmitter; const outputProcessedEmitter = this.onOutputProcessedEmitter; return { - onTaskCreated(event: TaskInfo) { + onTaskCreated(event: TaskInfo): void { newTaskEmitter.fire(event); }, - onTaskExit(event: TaskExitedEvent) { + onTaskExit(event: TaskExitedEvent): void { exitEmitter.fire(event); }, - onDidStartTaskProcess(event: TaskInfo) { + onDidStartTaskProcess(event: TaskInfo): void { taskProcessStartedEmitter.fire(event); }, - onDidEndTaskProcess(event: TaskExitedEvent) { + onDidEndTaskProcess(event: TaskExitedEvent): void { taskProcessEndedEmitter.fire(event); }, - onDidProcessTaskOutput(event: TaskOutputProcessedEvent) { + onDidProcessTaskOutput(event: TaskOutputProcessedEvent): void { outputProcessedEmitter.fire(event); } }; diff --git a/packages/task/src/node/process/process-task-runner-backend-module.ts b/packages/task/src/node/process/process-task-runner-backend-module.ts index d5519faa46f23..f9bccf94d511f 100644 --- a/packages/task/src/node/process/process-task-runner-backend-module.ts +++ b/packages/task/src/node/process/process-task-runner-backend-module.ts @@ -20,7 +20,7 @@ import { ProcessTaskRunner } from './process-task-runner'; import { ProcessTaskRunnerContribution } from './process-task-runner-contribution'; import { TaskRunnerContribution } from '../task-runner'; -export function bindProcessTaskRunnerModule(bind: interfaces.Bind) { +export function bindProcessTaskRunnerModule(bind: interfaces.Bind): void { bind(ProcessTask).toSelf().inTransientScope(); bind(TaskFactory).toFactory(ctx => diff --git a/packages/task/src/node/process/process-task-runner.ts b/packages/task/src/node/process/process-task-runner.ts index 72f8e1ee7a138..4ff754bbb9481 100644 --- a/packages/task/src/node/process/process-task-runner.ts +++ b/packages/task/src/node/process/process-task-runner.ts @@ -174,7 +174,7 @@ export class ProcessTaskRunner implements TaskRunner { return { command, args, options }; } - protected asFsPath(uriOrPath: string) { + protected asFsPath(uriOrPath: string): string { return (uriOrPath.startsWith('file:/')) ? FileUri.fsPath(uriOrPath) : uriOrPath; diff --git a/packages/task/src/node/process/process-task.ts b/packages/task/src/node/process/process-task.ts index ee0a1ac0b97a8..881f934c5f2c1 100644 --- a/packages/task/src/node/process/process-task.ts +++ b/packages/task/src/node/process/process-task.ts @@ -129,11 +129,11 @@ export class ProcessTask extends Task { }; } - get process() { + get process(): Process { return this.options.process; } - get processType() { + get processType(): ProcessType { return this.options.processType; } } diff --git a/packages/task/src/node/task-abstract-line-matcher.ts b/packages/task/src/node/task-abstract-line-matcher.ts index af6356b3861c6..3cacfe030ef6a 100644 --- a/packages/task/src/node/task-abstract-line-matcher.ts +++ b/packages/task/src/node/task-abstract-line-matcher.ts @@ -76,7 +76,7 @@ export abstract class AbstractLineMatcher { /** * Number of problem patterns that the line matcher uses. */ - get patternCount() { + get patternCount(): number { return this.patterns.length; } diff --git a/packages/task/src/node/task-server.slow-spec.ts b/packages/task/src/node/task-server.slow-spec.ts index 8722b81ddaff4..b72ac58055023 100644 --- a/packages/task/src/node/task-server.slow-spec.ts +++ b/packages/task/src/node/task-server.slow-spec.ts @@ -51,7 +51,7 @@ const commandWindowsNoop = 'rundll32.exe'; const wsRootUri: URI = FileUri.create(__dirname).resolve('../../test-resources'); const wsRoot: string = FileUri.fsPath(wsRootUri); -describe('Task server / back-end', function () { +describe('Task server / back-end', function (): void { this.timeout(10000); let server: http.Server | https.Server; @@ -74,7 +74,7 @@ describe('Task server / back-end', function () { s.close(); }); - it('task running in terminal - expected data is received from the terminal ws server', async function () { + it('task running in terminal - expected data is received from the terminal ws server', async function (): Promise { const someString = 'someSingleWordString'; // This test is flaky on Windows and fails intermittently. Disable it for now @@ -106,7 +106,7 @@ describe('Task server / back-end', function () { }); }); - it('task using raw process - task server success response shall not contain a terminal id', async function () { + it('task using raw process - task server success response shall not contain a terminal id', async function (): Promise { const someString = 'someSingleWordString'; const command = isWindows ? commandShortRunningWindows : (isOSX ? commandShortRunningOsx : commandShortRunning); const executable = FileUri.fsPath(wsRootUri.resolve(command)); @@ -130,7 +130,7 @@ describe('Task server / back-end', function () { await p; }); - it('task is executed successfully with cwd as a file URI', async function () { + it('task is executed successfully with cwd as a file URI', async function (): Promise { const command = isWindows ? commandShortRunningWindows : (isOSX ? commandShortRunningOsx : commandShortRunning); const config = createProcessTaskConfig('shell', command, [], FileUri.create(wsRoot).toString()); const taskInfo: TaskInfo = await taskServer.run(config, wsRoot); @@ -140,7 +140,7 @@ describe('Task server / back-end', function () { await p; }); - it('task is executed successfully using terminal process', async function () { + it('task is executed successfully using terminal process', async function (): Promise { const command = isWindows ? commandShortRunningWindows : (isOSX ? commandShortRunningOsx : commandShortRunning); const taskInfo: TaskInfo = await taskServer.run(createProcessTaskConfig('shell', command, []), wsRoot); @@ -149,7 +149,7 @@ describe('Task server / back-end', function () { await p; }); - it('task is executed successfully using raw process', async function () { + it('task is executed successfully using raw process', async function (): Promise { const command = isWindows ? commandShortRunningWindows : (isOSX ? commandShortRunningOsx : commandShortRunning); const executable = FileUri.fsPath(wsRootUri.resolve(command)); const taskInfo: TaskInfo = await taskServer.run(createProcessTaskConfig('process', executable, [])); @@ -159,7 +159,7 @@ describe('Task server / back-end', function () { await p; }); - it('task without a specific runner is executed successfully using as a process', async function () { + it('task without a specific runner is executed successfully using as a process', async function (): Promise { const command = isWindows ? commandWindowsNoop : commandUnixNoop; // there's no runner registered for the 'npm' task type @@ -171,7 +171,7 @@ describe('Task server / back-end', function () { await p; }); - it('task can successfully execute command found in system path using a terminal process', async function () { + it('task can successfully execute command found in system path using a terminal process', async function (): Promise { const command = isWindows ? commandWindowsNoop : commandUnixNoop; const opts: TaskConfiguration = createProcessTaskConfig('shell', command, []); @@ -182,7 +182,7 @@ describe('Task server / back-end', function () { await p; }); - it('task can successfully execute command found in system path using a raw process', async function () { + it('task can successfully execute command found in system path using a raw process', async function (): Promise { const command = isWindows ? commandWindowsNoop : commandUnixNoop; const taskInfo: TaskInfo = await taskServer.run(createProcessTaskConfig('process', command, []), wsRoot); @@ -191,7 +191,7 @@ describe('Task server / back-end', function () { await p; }); - it('task using type "terminal" can be killed', async function () { + it('task using type "terminal" can be killed', async function (): Promise { const taskInfo: TaskInfo = await taskServer.run(createTaskConfigTaskLongRunning('shell'), wsRoot); const p = new Promise((resolve, reject) => { @@ -226,7 +226,7 @@ describe('Task server / back-end', function () { } }); - it('task using type "process" can be killed', async function () { + it('task using type "process" can be killed', async function (): Promise { const taskInfo: TaskInfo = await taskServer.run(createTaskConfigTaskLongRunning('process'), wsRoot); const p = new Promise((resolve, reject) => { @@ -264,7 +264,7 @@ describe('Task server / back-end', function () { /** * TODO: Figure out how to debug a process that correctly starts but exits with a return code > 0 */ - it('task using terminal process can handle command that does not exist', async function () { + it('task using terminal process can handle command that does not exist', async function (): Promise { const taskInfo: TaskInfo = await taskServer.run(createProcessTaskConfig2('shell', bogusCommand, []), wsRoot); const p = new Promise((resolve, reject) => { @@ -288,12 +288,12 @@ describe('Task server / back-end', function () { } }); - it('task using raw process can handle command that does not exist', async function () { + it('task using raw process can handle command that does not exist', async function (): Promise { const p = taskServer.run(createProcessTaskConfig2('process', bogusCommand, []), wsRoot); await expectThrowsAsync(p, 'ENOENT'); }); - it('getTasks(ctx) returns tasks according to created context', async function () { + it('getTasks(ctx) returns tasks according to created context', async function (): Promise { const context1 = 'aContext'; const context2 = 'anotherContext'; @@ -326,7 +326,7 @@ describe('Task server / back-end', function () { await taskServer.kill(task6.taskId); }); - it('creating and killing a bunch of tasks works as expected', async function () { + it('creating and killing a bunch of tasks works as expected', async function (): Promise { // const command = isWindows ? command_absolute_path_long_running_windows : command_absolute_path_long_running; const numTasks = 20; const taskinfo: TaskInfo[] = []; diff --git a/packages/task/src/node/task-server.ts b/packages/task/src/node/task-server.ts index f788094c87cbd..f81c2e13d85be 100644 --- a/packages/task/src/node/task-server.ts +++ b/packages/task/src/node/task-server.ts @@ -51,7 +51,7 @@ export class TaskServerImpl implements TaskServer, Disposable { /** task context - {task id - problem collector} */ private problemCollectors: Map> = new Map(); - dispose() { + dispose(): void { for (const toDispose of this.toDispose.values()) { toDispose.dispose(); } @@ -126,7 +126,7 @@ export class TaskServerImpl implements TaskServer, Disposable { return this.runnerRegistry.getRunnerTypes(); } - protected fireTaskExitedEvent(event: TaskExitedEvent, task?: Task) { + protected fireTaskExitedEvent(event: TaskExitedEvent, task?: Task): void { this.logger.debug(log => log('task has exited:', event)); this.clients.forEach(client => { @@ -140,7 +140,7 @@ export class TaskServerImpl implements TaskServer, Disposable { } } - protected fireTaskCreatedEvent(event: TaskInfo, task?: Task) { + protected fireTaskCreatedEvent(event: TaskInfo, task?: Task): void { this.logger.debug(log => log('task created:', event)); this.clients.forEach(client => { @@ -154,7 +154,7 @@ export class TaskServerImpl implements TaskServer, Disposable { } } - protected fireTaskOutputProcessedEvent(event: TaskOutputProcessedEvent) { + protected fireTaskOutputProcessedEvent(event: TaskOutputProcessedEvent): void { this.clients.forEach(client => client.onDidProcessTaskOutput(event)); } @@ -171,13 +171,13 @@ export class TaskServerImpl implements TaskServer, Disposable { } /** Adds a client to this server */ - setClient(client: TaskClient) { + setClient(client: TaskClient): void { this.logger.debug('a client has connected - adding it to the list:'); this.clients.push(client); } /** Removes a client, from this server */ - disconnectClient(client: TaskClient) { + disconnectClient(client: TaskClient): void { this.logger.debug('a client has disconnected - removed from list:'); const idx = this.clients.indexOf(client); if (idx > -1) { diff --git a/packages/task/src/node/task.ts b/packages/task/src/node/task.ts index 3ee22209479e7..2be2307296988 100644 --- a/packages/task/src/node/task.ts +++ b/packages/task/src/node/task.ts @@ -68,19 +68,19 @@ export abstract class Task implements Disposable { /** Returns runtime information about task. */ abstract getRuntimeInfo(): MaybePromise; - get id() { + get id(): number { return this.taskId; } - get context() { + get context(): string | undefined { return this.options.context; } - get label() { + get label(): string { return this.options.label; } - dispose() { + dispose(): void { this.toDispose.dispose(); } } diff --git a/packages/terminal/src/browser/terminal-linkmatcher-files.ts b/packages/terminal/src/browser/terminal-linkmatcher-files.ts index f717a424cae19..ccface4612391 100644 --- a/packages/terminal/src/browser/terminal-linkmatcher-files.ts +++ b/packages/terminal/src/browser/terminal-linkmatcher-files.ts @@ -35,7 +35,7 @@ export class TerminalLinkmatcherFiles extends AbstractCmdClickTerminalContributi protected backendOs: Promise; @postConstruct() - protected init() { + protected init(): void { this.backendOs = this.appServer.getBackendOS(); } diff --git a/packages/terminal/src/browser/terminal-linkmatcher.ts b/packages/terminal/src/browser/terminal-linkmatcher.ts index 599f278c7bb64..13e0777b38619 100644 --- a/packages/terminal/src/browser/terminal-linkmatcher.ts +++ b/packages/terminal/src/browser/terminal-linkmatcher.ts @@ -29,7 +29,7 @@ export abstract class AbstractCmdClickTerminalContribution implements TerminalCo return () => Promise.resolve(true); } - async onCreate(terminalWidget: TerminalWidgetImpl) { + async onCreate(terminalWidget: TerminalWidgetImpl): Promise { const term = terminalWidget.getTerminal(); const regexp = await this.getRegExp(terminalWidget); const handler = this.getHandler(terminalWidget); @@ -79,11 +79,11 @@ export class URLMatcher extends AbstractCmdClickTerminalContribution { @inject(WindowService) protected readonly windowService: WindowService; - async getRegExp() { + async getRegExp(): Promise { return /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/; } - getHandler() { + getHandler(): (event: MouseEvent, uri: string) => void { return (event: MouseEvent, uri: string) => { this.windowService.openNewWindow(uri); }; @@ -96,11 +96,11 @@ export class LocalhostMatcher extends AbstractCmdClickTerminalContribution { @inject(WindowService) protected readonly windowService: WindowService; - async getRegExp() { + async getRegExp(): Promise { return /(https?:\/\/)?(localhost|127\.0\.0\.1|0\.0\.0\.0)(:[0-9]{1,5})?([-a-zA-Z0-9@:%_\+.~#?&//=]*)/; } - getHandler() { + getHandler(): (event: MouseEvent, uri: string) => void { return (event: MouseEvent, matched: string) => { const uri = matched.startsWith('http') ? matched : `http://${matched}`; this.windowService.openNewWindow(uri); diff --git a/packages/terminal/src/browser/terminal-widget-impl.ts b/packages/terminal/src/browser/terminal-widget-impl.ts index b6e3f7cd71e32..799f4a24dcf0d 100644 --- a/packages/terminal/src/browser/terminal-widget-impl.ts +++ b/packages/terminal/src/browser/terminal-widget-impl.ts @@ -188,18 +188,18 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget } } - showHoverMessage(x: number, y: number, message: string) { + showHoverMessage(x: number, y: number, message: string): void { this.hoverMessage.innerText = message; this.hoverMessage.style.display = 'inline'; this.hoverMessage.style.top = `${y - 30}px`; this.hoverMessage.style.left = `${x - 60}px`; } - hideHover() { + hideHover(): void { this.hoverMessage.style.display = 'none'; } - getTerminal() { + getTerminal(): Xterm.Terminal { return this.term; } @@ -221,7 +221,7 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget return this.shellTerminalServer.getProcessId(this.terminalId); } - onDispose(onDispose: () => void) { + onDispose(onDispose: () => void): void { this.toDispose.push(Disposable.create(onDispose)); } @@ -234,7 +234,7 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget return { terminalId: this.terminalId, titleLabel: this.title.label }; } - restoreState(oldState: object) { + restoreState(oldState: object): void { if (this.restored === false) { const state = oldState as { terminalId: number, titleLabel: string }; /* This is a workaround to issue #879 */ diff --git a/packages/terminal/src/common/terminal-common-module.ts b/packages/terminal/src/common/terminal-common-module.ts index 91ecee499d12b..2fe71c351eb44 100644 --- a/packages/terminal/src/common/terminal-common-module.ts +++ b/packages/terminal/src/common/terminal-common-module.ts @@ -22,7 +22,7 @@ import { ILogger } from '@theia/core'; * * @param bind The bind function from inversify. */ -export function createCommonBindings(bind: interfaces.Bind) { +export function createCommonBindings(bind: interfaces.Bind): void { bind(ILogger).toDynamicValue(ctx => { const logger = ctx.container.get(ILogger); return logger.child('terminal'); diff --git a/packages/terminal/src/common/terminal-watcher.ts b/packages/terminal/src/common/terminal-watcher.ts index d23f46c07d679..2fe2155c8ef43 100644 --- a/packages/terminal/src/common/terminal-watcher.ts +++ b/packages/terminal/src/common/terminal-watcher.ts @@ -25,10 +25,10 @@ export class TerminalWatcher { const exitEmitter = this.onTerminalExitEmitter; const errorEmitter = this.onTerminalErrorEmitter; return { - onTerminalExitChanged(event: IBaseTerminalExitEvent) { + onTerminalExitChanged(event: IBaseTerminalExitEvent): void { exitEmitter.fire(event); }, - onTerminalError(event: IBaseTerminalErrorEvent) { + onTerminalError(event: IBaseTerminalErrorEvent): void { errorEmitter.fire(event); } }; diff --git a/packages/terminal/src/node/shell-terminal-server.spec.ts b/packages/terminal/src/node/shell-terminal-server.spec.ts index 4148ab31cf829..eb3eba7132eb7 100644 --- a/packages/terminal/src/node/shell-terminal-server.spec.ts +++ b/packages/terminal/src/node/shell-terminal-server.spec.ts @@ -23,7 +23,7 @@ import { IShellTerminalServer } from '../common/shell-terminal-protocol'; const expect = chai.expect; -describe('ShellServer', function () { +describe('ShellServer', function (): void { this.timeout(5000); let shellTerminalServer: IShellTerminalServer; @@ -32,7 +32,7 @@ describe('ShellServer', function () { shellTerminalServer = createTerminalTestContainer().get(IShellTerminalServer); }); - it('test shell terminal create', async function () { + it('test shell terminal create', async function (): Promise { const createResult = shellTerminalServer.create({}); expect(await createResult).to.be.greaterThan(-1); diff --git a/packages/terminal/src/node/terminal-backend-contribution.slow-spec.ts b/packages/terminal/src/node/terminal-backend-contribution.slow-spec.ts index 064f1b828db37..913cc0c5fc5f5 100644 --- a/packages/terminal/src/node/terminal-backend-contribution.slow-spec.ts +++ b/packages/terminal/src/node/terminal-backend-contribution.slow-spec.ts @@ -22,7 +22,7 @@ import * as https from 'https'; import { terminalsPath } from '../common/terminal-protocol'; import { TestWebSocketChannel } from '@theia/core/lib/node/messaging/test/test-web-socket-channel'; -describe('Terminal Backend Contribution', function () { +describe('Terminal Backend Contribution', function (): void { this.timeout(10000); let server: http.Server | https.Server; diff --git a/packages/terminal/src/node/terminal-server.spec.ts b/packages/terminal/src/node/terminal-server.spec.ts index 36d70058b1a06..adc8da043f4c8 100644 --- a/packages/terminal/src/node/terminal-server.spec.ts +++ b/packages/terminal/src/node/terminal-server.spec.ts @@ -24,7 +24,7 @@ import { ITerminalServer } from '../common/terminal-protocol'; const expect = chai.expect; -describe('TermninalServer', function () { +describe('TermninalServer', function (): void { this.timeout(5000); let terminalServer: ITerminalServer; @@ -34,13 +34,13 @@ describe('TermninalServer', function () { terminalServer = container.get(ITerminalServer); }); - it('test terminal create', async function () { + it('test terminal create', async function (): Promise { const args = ['--version']; const createResult = await terminalServer.create({ command: process.execPath, 'args': args }); expect(createResult).to.be.greaterThan(-1); }); - it('test terminal create from non-existent path', async function () { + it('test terminal create from non-existent path', async function (): Promise { const createError = await terminalServer.create({ command: '/non-existent' }); expect(createError).eq(-1); }); diff --git a/packages/terminal/src/node/test/terminal-test-container.ts b/packages/terminal/src/node/test/terminal-test-container.ts index 5a097785a6204..5e96b75e3c5d3 100644 --- a/packages/terminal/src/node/test/terminal-test-container.ts +++ b/packages/terminal/src/node/test/terminal-test-container.ts @@ -20,7 +20,7 @@ import processBackendModule from '@theia/process/lib/node/process-backend-module import { messagingBackendModule } from '@theia/core/lib/node/messaging/messaging-backend-module'; import terminalBackendModule from '../terminal-backend-module'; -export function createTerminalTestContainer() { +export function createTerminalTestContainer(): Container { const container = new Container(); container.load(backendApplicationModule); bindLogger(container.bind.bind(container)); diff --git a/packages/textmate-grammars/src/browser/bat.ts b/packages/textmate-grammars/src/browser/bat.ts index 0fb3a0dfce610..523228248bc22 100644 --- a/packages/textmate-grammars/src/browser/bat.ts +++ b/packages/textmate-grammars/src/browser/bat.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class BatContribution implements LanguageGrammarDefinitionContribution { readonly id = 'bat'; readonly scopeName = 'source.batchfile'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.bat', '.cmd'], @@ -58,7 +58,7 @@ export class BatContribution implements LanguageGrammarDefinitionContribution { }); const grammar = require('../../data/bat.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/clojure.ts b/packages/textmate-grammars/src/browser/clojure.ts index e80d39e6e7bee..134c8efcef2f9 100644 --- a/packages/textmate-grammars/src/browser/clojure.ts +++ b/packages/textmate-grammars/src/browser/clojure.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class ClojureContribution implements LanguageGrammarDefinitionContributio readonly id = 'clojure'; readonly scopeName = 'source.clojure'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.clj', '.cljs', '.cljc', '.edn'], @@ -56,7 +56,7 @@ export class ClojureContribution implements LanguageGrammarDefinitionContributio }); const grammar = require('../../data/clojure.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/coffeescript.ts b/packages/textmate-grammars/src/browser/coffeescript.ts index 131d1c3a23ced..c66521afbd692 100644 --- a/packages/textmate-grammars/src/browser/coffeescript.ts +++ b/packages/textmate-grammars/src/browser/coffeescript.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class CoffeescriptContribution implements LanguageGrammarDefinitionContri readonly id = 'coffeescript'; readonly scopeName = 'source.coffee'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.coffee', '.litcoffee'], @@ -63,7 +63,7 @@ export class CoffeescriptContribution implements LanguageGrammarDefinitionContri }); const grammar = require('../../data/coffeescript.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/cpp.ts b/packages/textmate-grammars/src/browser/cpp.ts index 985cdbb4badce..53c880d983422 100644 --- a/packages/textmate-grammars/src/browser/cpp.ts +++ b/packages/textmate-grammars/src/browser/cpp.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -57,7 +57,7 @@ export class CppContribution implements LanguageGrammarDefinitionContribution { } }; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.C_LANGUAGE_ID, extensions: ['.c'], @@ -68,7 +68,7 @@ export class CppContribution implements LanguageGrammarDefinitionContribution { const platformGrammar = require('../../data/platform.tmLanguage.json'); registry.registerTextmateGrammarScope('source.c.platform', { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: platformGrammar @@ -78,7 +78,7 @@ export class CppContribution implements LanguageGrammarDefinitionContribution { const cGrammar = require('../../data/c.tmLanguage.json'); registry.registerTextmateGrammarScope('source.c', { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: cGrammar @@ -98,7 +98,7 @@ export class CppContribution implements LanguageGrammarDefinitionContribution { const cppGrammar = require('../../data/cpp.tmLanguage.json'); registry.registerTextmateGrammarScope('source.cpp', { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: cppGrammar diff --git a/packages/textmate-grammars/src/browser/csharp.ts b/packages/textmate-grammars/src/browser/csharp.ts index 68a5bb7d7478d..b6f8f11088c15 100644 --- a/packages/textmate-grammars/src/browser/csharp.ts +++ b/packages/textmate-grammars/src/browser/csharp.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class CSharpContribution implements LanguageGrammarDefinitionContribution readonly id = 'csharp'; readonly scopeName = 'source.cs'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.cs'], @@ -64,7 +64,7 @@ export class CSharpContribution implements LanguageGrammarDefinitionContribution }); const grammar = require('../../data/csharp.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/css.ts b/packages/textmate-grammars/src/browser/css.ts index 974347ff70ceb..4a9fdc0df4da1 100644 --- a/packages/textmate-grammars/src/browser/css.ts +++ b/packages/textmate-grammars/src/browser/css.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class CssContribution implements LanguageGrammarDefinitionContribution { readonly id = 'css'; readonly scopeName = 'source.css'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.css'], @@ -68,7 +68,7 @@ export class CssContribution implements LanguageGrammarDefinitionContribution { }); const grammar = require('../../data/css.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/fsharp.ts b/packages/textmate-grammars/src/browser/fsharp.ts index 1eb0bfb26c6ba..eb8a81c2c4f96 100644 --- a/packages/textmate-grammars/src/browser/fsharp.ts +++ b/packages/textmate-grammars/src/browser/fsharp.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class FSharpContribution implements LanguageGrammarDefinitionContribution readonly id = 'fsharp'; readonly scopeName = 'source.fsharp'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.fs', '.fsi', '.fsx', '.fsscript'], @@ -62,7 +62,7 @@ export class FSharpContribution implements LanguageGrammarDefinitionContribution }); const grammar = require('../../data/fsharp.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/go.ts b/packages/textmate-grammars/src/browser/go.ts index 3f9ee7ae9d930..e21bc699051c3 100644 --- a/packages/textmate-grammars/src/browser/go.ts +++ b/packages/textmate-grammars/src/browser/go.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -52,7 +52,7 @@ export class GoContribution implements LanguageGrammarDefinitionContribution { } }; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.go'], @@ -63,7 +63,7 @@ export class GoContribution implements LanguageGrammarDefinitionContribution { const goGrammar = require('../../data/go.tmLanguage.json'); registry.registerTextmateGrammarScope('source.go', { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: goGrammar diff --git a/packages/textmate-grammars/src/browser/groovy.ts b/packages/textmate-grammars/src/browser/groovy.ts index 23d26bc5f272a..7bf7fab577300 100644 --- a/packages/textmate-grammars/src/browser/groovy.ts +++ b/packages/textmate-grammars/src/browser/groovy.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class GroovyContribution implements LanguageGrammarDefinitionContribution readonly id = 'groovy'; readonly scopeName = 'source.groovy'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, aliases: ['Groovy', 'groovy'], @@ -58,7 +58,7 @@ export class GroovyContribution implements LanguageGrammarDefinitionContribution }); const grammar = require('../../data/groovy.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/handlebars.ts b/packages/textmate-grammars/src/browser/handlebars.ts index 78f614db813f1..5b1cab833f7f9 100644 --- a/packages/textmate-grammars/src/browser/handlebars.ts +++ b/packages/textmate-grammars/src/browser/handlebars.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class HandlebarsContribution implements LanguageGrammarDefinitionContribu readonly id = 'handlebars'; readonly scopeName = 'text.html.handlebars'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.handlebars', '.hbs', '.hjs'], @@ -56,7 +56,7 @@ export class HandlebarsContribution implements LanguageGrammarDefinitionContribu }); const grammar = require('../../data/handlebars.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/hlsl.ts b/packages/textmate-grammars/src/browser/hlsl.ts index 0bd475c573c65..20d5e5ba84218 100644 --- a/packages/textmate-grammars/src/browser/hlsl.ts +++ b/packages/textmate-grammars/src/browser/hlsl.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class HlslContribution implements LanguageGrammarDefinitionContribution { readonly id = 'hlsl'; readonly scopeName = 'source.hlsl'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.hlsl', '.hlsli', '.fx', '.fxh', '.vsh', '.psh', '.cginc', '.compute'], @@ -54,7 +54,7 @@ export class HlslContribution implements LanguageGrammarDefinitionContribution { }); const grammar = require('../../data/hlsl.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/html.ts b/packages/textmate-grammars/src/browser/html.ts index d202e8542784f..ce7f65dabb5df 100644 --- a/packages/textmate-grammars/src/browser/html.ts +++ b/packages/textmate-grammars/src/browser/html.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; const EMPTY_ELEMENTS: string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']; @@ -25,7 +25,7 @@ export class HtmlContribution implements LanguageGrammarDefinitionContribution { readonly id = 'html'; readonly scopeName = 'text.html.basic'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.html', '.htm', '.shtml', '.xhtml', '.mdoc', '.jsp', '.asp', '.aspx', '.jshtm'], @@ -85,7 +85,7 @@ export class HtmlContribution implements LanguageGrammarDefinitionContribution { const grammar = require('../../data/html.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/ini.ts b/packages/textmate-grammars/src/browser/ini.ts index eafec7cb96ad5..3ce33df5f8e7c 100644 --- a/packages/textmate-grammars/src/browser/ini.ts +++ b/packages/textmate-grammars/src/browser/ini.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class IniContribution implements LanguageGrammarDefinitionContribution { readonly id = 'ini'; readonly scopeName = 'source.ini'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.ini', '.properties', '.toml'], @@ -57,7 +57,7 @@ export class IniContribution implements LanguageGrammarDefinitionContribution { }); const grammar = require('../../data/ini.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/java.ts b/packages/textmate-grammars/src/browser/java.ts index e9487fdfc9aef..bccb3b242c9a7 100644 --- a/packages/textmate-grammars/src/browser/java.ts +++ b/packages/textmate-grammars/src/browser/java.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class JavaContribution implements LanguageGrammarDefinitionContribution { private readonly javaScope = 'source.java'; private readonly javaDocScope = 'text.html.javadoc'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: [ @@ -55,7 +55,7 @@ export class JavaContribution implements LanguageGrammarDefinitionContribution { const javaDocGrammar = require('../../data/java.tmLanguage.json'); registry.registerTextmateGrammarScope(this.javaDocScope, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: javaDocGrammar @@ -64,7 +64,7 @@ export class JavaContribution implements LanguageGrammarDefinitionContribution { }); const javaGrammar = require('../../data/java.tmLanguage.json'); registry.registerTextmateGrammarScope(this.javaScope, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: javaGrammar diff --git a/packages/textmate-grammars/src/browser/js.ts b/packages/textmate-grammars/src/browser/js.ts index bc10d127e9ac3..b6daea6a5c568 100644 --- a/packages/textmate-grammars/src/browser/js.ts +++ b/packages/textmate-grammars/src/browser/js.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { injectable } from 'inversify'; -import { LanguageGrammarDefinitionContribution, TextmateRegistry, getEncodedLanguageId } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, getEncodedLanguageId, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { StandardTokenType } from 'vscode-textmate'; @injectable() @@ -23,11 +23,11 @@ export class JavascriptContribution implements LanguageGrammarDefinitionContribu readonly js_id = 'javascript'; readonly js_react_id = 'javascriptreact'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { this.registerJavaScript(); const grammar = require('../../data/javascript.tmlanguage.json'); registry.registerTextmateGrammarScope('source.js', { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar, @@ -36,7 +36,7 @@ export class JavascriptContribution implements LanguageGrammarDefinitionContribu }); registry.registerTextmateGrammarScope('source.js.regexp', { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'plist', content: regExpGrammar, @@ -63,7 +63,7 @@ export class JavascriptContribution implements LanguageGrammarDefinitionContribu const jsxGrammar = require('../../data/javascript.jsx.tmlanguage.json'); registry.registerTextmateGrammarScope('source.jsx', { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: jsxGrammar, @@ -74,7 +74,7 @@ export class JavascriptContribution implements LanguageGrammarDefinitionContribu registry.mapLanguageIdToTextmateGrammar(this.js_react_id, 'source.jsx'); } - protected registerJavaScript() { + protected registerJavaScript(): void { monaco.languages.register({ id: this.js_id, aliases: [ diff --git a/packages/textmate-grammars/src/browser/jsx-tags.ts b/packages/textmate-grammars/src/browser/jsx-tags.ts index 24f19791b0e5f..e2dea5fe0e550 100644 --- a/packages/textmate-grammars/src/browser/jsx-tags.ts +++ b/packages/textmate-grammars/src/browser/jsx-tags.ts @@ -21,11 +21,11 @@ import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/ export class JsxTagsContribution implements LanguageGrammarDefinitionContribution { private readonly id = 'jsx-tags'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { this.registerJsxTags(); } - protected registerJsxTags() { + protected registerJsxTags(): void { monaco.languages.register({ id: this.id }); diff --git a/packages/textmate-grammars/src/browser/less.ts b/packages/textmate-grammars/src/browser/less.ts index 8a61145409c41..3447d344064f0 100644 --- a/packages/textmate-grammars/src/browser/less.ts +++ b/packages/textmate-grammars/src/browser/less.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class LessContribution implements LanguageGrammarDefinitionContribution { readonly id = 'less'; readonly scopeName = 'source.css.less'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.less'], @@ -65,7 +65,7 @@ export class LessContribution implements LanguageGrammarDefinitionContribution { const grammar = require('../../data/less.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/log.ts b/packages/textmate-grammars/src/browser/log.ts index 0e5d26bcf8751..8d00ec42776c0 100644 --- a/packages/textmate-grammars/src/browser/log.ts +++ b/packages/textmate-grammars/src/browser/log.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class LogContribution implements LanguageGrammarDefinitionContribution { readonly id = 'log'; readonly scopeName = 'text.log'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.log', '*.log.?'], @@ -31,7 +31,7 @@ export class LogContribution implements LanguageGrammarDefinitionContribution { }); const grammar = require('../../data/log.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/lua.ts b/packages/textmate-grammars/src/browser/lua.ts index 9b6dffc509e0e..a9303ec1cb1d9 100644 --- a/packages/textmate-grammars/src/browser/lua.ts +++ b/packages/textmate-grammars/src/browser/lua.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class LuaContribution implements LanguageGrammarDefinitionContribution { readonly id = 'lua'; readonly scopeName = 'source.lua'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.lua'], @@ -60,7 +60,7 @@ export class LuaContribution implements LanguageGrammarDefinitionContribution { }); const grammar = require('../../data/lua.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/make.ts b/packages/textmate-grammars/src/browser/make.ts index 285e293f02fc3..d1a9fa72e176b 100644 --- a/packages/textmate-grammars/src/browser/make.ts +++ b/packages/textmate-grammars/src/browser/make.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class MakeContribution implements LanguageGrammarDefinitionContribution { readonly id = 'makefile'; readonly scopeName = 'source.makefile'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, aliases: ['Makefile', 'makefile'], @@ -48,7 +48,7 @@ export class MakeContribution implements LanguageGrammarDefinitionContribution { }); const grammar = require('../../data/make.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/markdown.ts b/packages/textmate-grammars/src/browser/markdown.ts index 38baefdd811dd..ac171b9a1dc3e 100644 --- a/packages/textmate-grammars/src/browser/markdown.ts +++ b/packages/textmate-grammars/src/browser/markdown.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class MarkdownContribution implements LanguageGrammarDefinitionContributi readonly id = 'markdown'; readonly scopeName = 'text.html.markdown'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.md', '.markdown', '.mdown', '.mkdn', '.mkd', '.mdwn', '.mdtxt', '.mdtext'], @@ -59,7 +59,7 @@ export class MarkdownContribution implements LanguageGrammarDefinitionContributi const grammar = require('../../data/markdown.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/objective-c.ts b/packages/textmate-grammars/src/browser/objective-c.ts index c74a9e263a0ae..0d5e61fae128d 100644 --- a/packages/textmate-grammars/src/browser/objective-c.ts +++ b/packages/textmate-grammars/src/browser/objective-c.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class ObjectiveCContribution implements LanguageGrammarDefinitionContribu readonly id = 'objective-c'; readonly scopeName = 'source.objc'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.m'], @@ -56,7 +56,7 @@ export class ObjectiveCContribution implements LanguageGrammarDefinitionContribu }); const grammar = require('../../data/objective-c.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/perl.ts b/packages/textmate-grammars/src/browser/perl.ts index 536d9b92de6e7..7e122ff50126a 100644 --- a/packages/textmate-grammars/src/browser/perl.ts +++ b/packages/textmate-grammars/src/browser/perl.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -49,7 +49,7 @@ export class PerlContribution implements LanguageGrammarDefinitionContribution { ] }; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, aliases: ['Perl', 'perl'], @@ -61,7 +61,7 @@ export class PerlContribution implements LanguageGrammarDefinitionContribution { const grammar = require('../../data/perl.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/php.ts b/packages/textmate-grammars/src/browser/php.ts index 3fe20db44eb97..dd69d826bb58e 100644 --- a/packages/textmate-grammars/src/browser/php.ts +++ b/packages/textmate-grammars/src/browser/php.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable, inject } from 'inversify'; import { MonacoSnippetSuggestProvider } from '@theia/monaco/lib/browser/monaco-snippet-suggest-provider'; @@ -65,7 +65,7 @@ export class PhpGrammarContribution implements LanguageGrammarDefinitionContribu } }; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, 'extensions': [ @@ -95,7 +95,7 @@ export class PhpGrammarContribution implements LanguageGrammarDefinitionContribu const phpGrammar = require('../../data/php.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: phpGrammar diff --git a/packages/textmate-grammars/src/browser/powershell.ts b/packages/textmate-grammars/src/browser/powershell.ts index b5f905ddb2b37..cb472ae7c5603 100644 --- a/packages/textmate-grammars/src/browser/powershell.ts +++ b/packages/textmate-grammars/src/browser/powershell.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class PowershellContribution implements LanguageGrammarDefinitionContribu readonly id = 'powershell'; readonly scopeName = 'source.powershell'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.ps1', '.psm1', '.psd1', '.pssc', '.psrc'], @@ -64,7 +64,7 @@ export class PowershellContribution implements LanguageGrammarDefinitionContribu }); const grammar = require('../../data/powershell.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/pug.ts b/packages/textmate-grammars/src/browser/pug.ts index a5994a1e9cc41..10f94fb005718 100644 --- a/packages/textmate-grammars/src/browser/pug.ts +++ b/packages/textmate-grammars/src/browser/pug.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class PugContribution implements LanguageGrammarDefinitionContribution { readonly id = 'jade'; readonly scopeName = 'text.pug'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.jade', '.pug'], @@ -58,7 +58,7 @@ export class PugContribution implements LanguageGrammarDefinitionContribution { }); const grammar = require('../../data/pug.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/python.ts b/packages/textmate-grammars/src/browser/python.ts index eb4ad78bd17b6..4ba00c98df7eb 100644 --- a/packages/textmate-grammars/src/browser/python.ts +++ b/packages/textmate-grammars/src/browser/python.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -57,7 +57,7 @@ export class PythonContribution implements LanguageGrammarDefinitionContribution ] }; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.py', '.rpy', '.pyw', '.cpy', '.gyp', '.gypi', '.snakefile', '.smk'], @@ -69,7 +69,7 @@ export class PythonContribution implements LanguageGrammarDefinitionContribution const platformGrammar = require('../../data/MagicPython.tmLanguage.json'); registry.registerTextmateGrammarScope('source.python', { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: platformGrammar @@ -79,7 +79,7 @@ export class PythonContribution implements LanguageGrammarDefinitionContribution const cGrammar = require('../../data/MagicRegExp.tmLanguage.json'); registry.registerTextmateGrammarScope('source.regexp.python', { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: cGrammar diff --git a/packages/textmate-grammars/src/browser/r.ts b/packages/textmate-grammars/src/browser/r.ts index 238d2fd4042ab..0956d39adcc89 100644 --- a/packages/textmate-grammars/src/browser/r.ts +++ b/packages/textmate-grammars/src/browser/r.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class RContribution implements LanguageGrammarDefinitionContribution { readonly id = 'r'; readonly scopeName = 'source.r'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.r', '.rhistory', '.rprofile', '.rt'], @@ -53,7 +53,7 @@ export class RContribution implements LanguageGrammarDefinitionContribution { }); const grammar = require('../../data/r.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/razor.ts b/packages/textmate-grammars/src/browser/razor.ts index 05aa0f1dd65ec..539ec9fee1bbc 100644 --- a/packages/textmate-grammars/src/browser/razor.ts +++ b/packages/textmate-grammars/src/browser/razor.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class RazorContribution implements LanguageGrammarDefinitionContribution readonly id = 'razor'; readonly scopeName = 'text.html.cshtml'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.cshtml'], @@ -61,7 +61,7 @@ export class RazorContribution implements LanguageGrammarDefinitionContribution }); const grammar = require('../../data/razor.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/rust.ts b/packages/textmate-grammars/src/browser/rust.ts index ac5f95ac9ad25..1502dc47ff8be 100644 --- a/packages/textmate-grammars/src/browser/rust.ts +++ b/packages/textmate-grammars/src/browser/rust.ts @@ -19,7 +19,7 @@ *--------------------------------------------------------------------------------------------*/ import { injectable } from 'inversify'; -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; @injectable() export class RustContribution implements LanguageGrammarDefinitionContribution { @@ -56,7 +56,7 @@ export class RustContribution implements LanguageGrammarDefinitionContribution { } }; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ // copied from https://github.com/Microsoft/vscode/blob/9e1975d98598ef268ca760b8381ee628f27fc121/extensions/rust/package.json#L12-L17 id: this.id, @@ -69,7 +69,7 @@ export class RustContribution implements LanguageGrammarDefinitionContribution { // copied from https://github.com/Microsoft/vscode/blob/9e1975d98598ef268ca760b8381ee628f27fc121/extensions/rust/syntaxes/rust.tmLanguage.json const platformGrammar = require('../../data/rust.tmLanguage.json'); registry.registerTextmateGrammarScope('source.rust', { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: platformGrammar diff --git a/packages/textmate-grammars/src/browser/scss.ts b/packages/textmate-grammars/src/browser/scss.ts index b8c39dd1fda08..5b43e84390bfe 100644 --- a/packages/textmate-grammars/src/browser/scss.ts +++ b/packages/textmate-grammars/src/browser/scss.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class ScssContribution implements LanguageGrammarDefinitionContribution { readonly id = 'scss'; readonly scopeName = 'source.css.scss'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.scss'], @@ -64,7 +64,7 @@ export class ScssContribution implements LanguageGrammarDefinitionContribution { const grammar = require('../../data/scss.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/shaderlab.ts b/packages/textmate-grammars/src/browser/shaderlab.ts index 892668a69acbb..9ce701561b81c 100644 --- a/packages/textmate-grammars/src/browser/shaderlab.ts +++ b/packages/textmate-grammars/src/browser/shaderlab.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class ShaderlabContribution implements LanguageGrammarDefinitionContribut readonly id = 'shaderlab'; readonly scopeName = 'source.shaderlab'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.shader'], @@ -54,7 +54,7 @@ export class ShaderlabContribution implements LanguageGrammarDefinitionContribut }); const grammar = require('../../data/shaderlab.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/shell.ts b/packages/textmate-grammars/src/browser/shell.ts index 9f0654fb224a6..168683e5fcd29 100644 --- a/packages/textmate-grammars/src/browser/shell.ts +++ b/packages/textmate-grammars/src/browser/shell.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class ShellContribution implements LanguageGrammarDefinitionContribution readonly id = 'shell'; readonly scopeName = 'source.shell'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.sh', '.bash'], @@ -54,7 +54,7 @@ export class ShellContribution implements LanguageGrammarDefinitionContribution const grammar = require('../../data/shell.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/sql.ts b/packages/textmate-grammars/src/browser/sql.ts index 968e7219a657d..8a43ad27b878d 100644 --- a/packages/textmate-grammars/src/browser/sql.ts +++ b/packages/textmate-grammars/src/browser/sql.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class SqlContribution implements LanguageGrammarDefinitionContribution { readonly id = 'sql'; readonly scopeName = 'source.sql'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.sql', '.dsql'], @@ -57,7 +57,7 @@ export class SqlContribution implements LanguageGrammarDefinitionContribution { }); const grammar = require('../../data/sql.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/swift.ts b/packages/textmate-grammars/src/browser/swift.ts index 010149fa8c5ac..59af2970353e0 100644 --- a/packages/textmate-grammars/src/browser/swift.ts +++ b/packages/textmate-grammars/src/browser/swift.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class SwiftContribution implements LanguageGrammarDefinitionContribution readonly id = 'swift'; readonly scopeName = 'source.swift'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, aliases: ['Swift', 'swift'], @@ -58,7 +58,7 @@ export class SwiftContribution implements LanguageGrammarDefinitionContribution }); const grammar = require('../../data/swift.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/tcl.ts b/packages/textmate-grammars/src/browser/tcl.ts index f1ac211d0bb6d..f15d9a90ba77a 100644 --- a/packages/textmate-grammars/src/browser/tcl.ts +++ b/packages/textmate-grammars/src/browser/tcl.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class TclContribution implements LanguageGrammarDefinitionContribution { readonly id = 'tcl'; readonly scopeName = 'source.tcl'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, aliases: ['TCL', 'tcl', 'Tcl'], @@ -32,7 +32,7 @@ export class TclContribution implements LanguageGrammarDefinitionContribution { }); const grammar = require('../../data/Tcl.plist'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { const grammarResponse: Response = await fetch(grammar); const grammarText: string = await grammarResponse.text(); return { diff --git a/packages/textmate-grammars/src/browser/ts.ts b/packages/textmate-grammars/src/browser/ts.ts index 4c5486a004ba1..d5946a85e6620 100644 --- a/packages/textmate-grammars/src/browser/ts.ts +++ b/packages/textmate-grammars/src/browser/ts.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { injectable, inject } from 'inversify'; -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { MonacoSnippetSuggestProvider } from '@theia/monaco/lib/browser/monaco-snippet-suggest-provider'; @injectable() @@ -26,12 +26,12 @@ export class TypescriptContribution implements LanguageGrammarDefinitionContribu @inject(MonacoSnippetSuggestProvider) protected readonly snippetSuggestProvider: MonacoSnippetSuggestProvider; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { this.registerTypeScript(); this.registerSnippets(); const grammar = require('../../data/typescript.tmlanguage.json'); registry.registerTextmateGrammarScope('source.ts', { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar, @@ -51,7 +51,7 @@ export class TypescriptContribution implements LanguageGrammarDefinitionContribu const jsxGrammar = require('../../data/typescript.tsx.tmlanguage.json'); registry.registerTextmateGrammarScope('source.tsx', { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: jsxGrammar, @@ -70,7 +70,7 @@ export class TypescriptContribution implements LanguageGrammarDefinitionContribu }); } - protected registerTypeScript() { + protected registerTypeScript(): void { monaco.languages.register({ id: this.ts_id, aliases: [ diff --git a/packages/textmate-grammars/src/browser/vb.ts b/packages/textmate-grammars/src/browser/vb.ts index 320b5710632d1..9142824016d8d 100644 --- a/packages/textmate-grammars/src/browser/vb.ts +++ b/packages/textmate-grammars/src/browser/vb.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class VbContribution implements LanguageGrammarDefinitionContribution { readonly id = 'vb'; readonly scopeName = 'source.asp.vb.net'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: ['.vb', '.brs', '.vbs', '.bas'], @@ -61,7 +61,7 @@ export class VbContribution implements LanguageGrammarDefinitionContribution { }); const grammar = require('../../data/vb.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/xml.ts b/packages/textmate-grammars/src/browser/xml.ts index 575da73a61d32..09096945f31ca 100644 --- a/packages/textmate-grammars/src/browser/xml.ts +++ b/packages/textmate-grammars/src/browser/xml.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class XmlContribution implements LanguageGrammarDefinitionContribution { readonly id = 'xml'; readonly scopeName = 'text.xml'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: [ @@ -110,7 +110,7 @@ export class XmlContribution implements LanguageGrammarDefinitionContribution { const grammar = require('../../data/xml.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/textmate-grammars/src/browser/xsl.ts b/packages/textmate-grammars/src/browser/xsl.ts index 2c71f2165090f..624b851e182de 100644 --- a/packages/textmate-grammars/src/browser/xsl.ts +++ b/packages/textmate-grammars/src/browser/xsl.ts @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -import { LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import { LanguageGrammarDefinitionContribution, TextmateRegistry, GrammarDefinition } from '@theia/monaco/lib/browser/textmate'; import { injectable } from 'inversify'; @injectable() @@ -23,7 +23,7 @@ export class XslContribution implements LanguageGrammarDefinitionContribution { readonly id = 'xsl'; readonly scopeName = 'text.xml.xsl'; - registerTextmateLanguage(registry: TextmateRegistry) { + registerTextmateLanguage(registry: TextmateRegistry): void { monaco.languages.register({ id: this.id, extensions: [ @@ -44,7 +44,7 @@ export class XslContribution implements LanguageGrammarDefinitionContribution { const grammar = require('../../data/xsl.tmLanguage.json'); registry.registerTextmateGrammarScope(this.scopeName, { - async getGrammarDefinition() { + async getGrammarDefinition(): Promise { return { format: 'json', content: grammar diff --git a/packages/typescript/src/browser/typescript-client-contribution.ts b/packages/typescript/src/browser/typescript-client-contribution.ts index 0a0a6b980f36c..94a87d958ea96 100644 --- a/packages/typescript/src/browser/typescript-client-contribution.ts +++ b/packages/typescript/src/browser/typescript-client-contribution.ts @@ -106,7 +106,7 @@ export class TypeScriptClientContribution extends BaseLanguageClientContribution ]; } - protected get workspaceContains() { + protected get workspaceContains(): string[] { // FIXME requires https://github.com/theia-ide/theia/issues/2359 // return [ // "**/tsconfig.json", diff --git a/packages/typescript/src/node/typescript-version-service-impl.spec.ts b/packages/typescript/src/node/typescript-version-service-impl.spec.ts index 6f6e8f1246ed8..c99f34d6897dc 100644 --- a/packages/typescript/src/node/typescript-version-service-impl.spec.ts +++ b/packages/typescript/src/node/typescript-version-service-impl.spec.ts @@ -22,7 +22,7 @@ import { isWindows } from '@theia/core/lib/common/os'; import { FileUri } from '@theia/core/lib/node'; import { TypescriptVersionServiceImpl, TypescriptVersionURI } from './typescript-version-service-impl'; -describe('TypescriptVersionServiceImpl', function () { +describe('TypescriptVersionServiceImpl', function (): void { const projectUri = FileUri.create(path.resolve(__dirname, '../../../..')); let impl: TypescriptVersionServiceImpl; diff --git a/packages/workspace/src/browser/diff-service.ts b/packages/workspace/src/browser/diff-service.ts index 54f513a333fd0..c9046ff1b42b8 100644 --- a/packages/workspace/src/browser/diff-service.ts +++ b/packages/workspace/src/browser/diff-service.ts @@ -28,7 +28,7 @@ export class DiffService { @inject(OpenerService) protected readonly openerService: OpenerService; @inject(MessageService) protected readonly messageService: MessageService; - public async openDiffEditor(left: URI, right: URI, label?: string, options?: OpenerOptions) { + public async openDiffEditor(left: URI, right: URI, label?: string, options?: OpenerOptions): Promise { if (left.scheme === 'file' && right.scheme === 'file') { const [leftExists, rightExists] = await Promise.all([ this.fileSystem.exists(left.toString()), diff --git a/packages/workspace/src/browser/quick-open-workspace.ts b/packages/workspace/src/browser/quick-open-workspace.ts index 20a2c47554862..9ba657c4e49a6 100644 --- a/packages/workspace/src/browser/quick-open-workspace.ts +++ b/packages/workspace/src/browser/quick-open-workspace.ts @@ -90,7 +90,7 @@ export class QuickOpenWorkspace implements QuickOpenModel { acceptor(this.items); } - select() { + select(): void { this.items = []; this.opened = this.workspaceService.opened; this.workspaceService.recentWorkspaces().then(workspaceRoots => { diff --git a/packages/workspace/src/browser/workspace-commands.ts b/packages/workspace/src/browser/workspace-commands.ts index 78f0c8108cf1b..6397b97807c62 100644 --- a/packages/workspace/src/browser/workspace-commands.ts +++ b/packages/workspace/src/browser/workspace-commands.ts @@ -136,7 +136,7 @@ export namespace WorkspaceCommands { @injectable() export class FileMenuContribution implements MenuContribution { - registerMenus(registry: MenuModelRegistry) { + registerMenus(registry: MenuModelRegistry): void { registry.registerMenuAction(CommonMenus.FILE_NEW, { commandId: WorkspaceCommands.NEW_FILE.id }); @@ -159,7 +159,7 @@ export class FileMenuContribution implements MenuContribution { @injectable() export class EditMenuContribution implements MenuContribution { - registerMenus(registry: MenuModelRegistry) { + registerMenus(registry: MenuModelRegistry): void { registry.registerMenuAction(CommonMenus.EDIT_CLIPBOARD, { commandId: FileDownloadCommands.COPY_DOWNLOAD_LINK.id, order: '9999' diff --git a/packages/workspace/src/browser/workspace-service.spec.ts b/packages/workspace/src/browser/workspace-service.spec.ts index 16e1d54964694..32b0441aa6f3b 100644 --- a/packages/workspace/src/browser/workspace-service.spec.ts +++ b/packages/workspace/src/browser/workspace-service.spec.ts @@ -243,7 +243,7 @@ describe('WorkspaceService', () => { expect((mockILogger.error).called).to.be.true; }); - it('should use the workspace path in the URL fragment, if available', async function () { + it('should use the workspace path in the URL fragment, if available', async function (): Promise { const workspacePath = '/home/somewhere'; window.location.hash = '#' + workspacePath; const stat = { diff --git a/packages/workspace/src/browser/workspace-service.ts b/packages/workspace/src/browser/workspace-service.ts index 9a7b581b65e61..c5adeab601dcf 100644 --- a/packages/workspace/src/browser/workspace-service.ts +++ b/packages/workspace/src/browser/workspace-service.ts @@ -226,7 +226,7 @@ export class WorkspaceService implements FrontendApplicationContribution { return title ? `${title} — ${name}` : name; } - protected updateTitle() { + protected updateTitle(): void { let title: string | undefined; if (this._workspace) { const uri = new URI(this._workspace.uri); diff --git a/packages/workspace/src/browser/workspace-storage-service.ts b/packages/workspace/src/browser/workspace-storage-service.ts index f769092147f89..68eb18eb80d45 100644 --- a/packages/workspace/src/browser/workspace-storage-service.ts +++ b/packages/workspace/src/browser/workspace-storage-service.ts @@ -33,7 +33,7 @@ export class WorkspaceStorageService implements StorageService { @inject(WorkspaceService) protected workspaceService: WorkspaceService; @postConstruct() - protected init() { + protected init(): void { this.initialized = this.workspaceService.roots.then(() => { this.updatePrefix(); this.workspaceService.onWorkspaceLocationChanged(() => this.updatePrefix()); diff --git a/packages/workspace/src/browser/workspace-uri-contribution.ts b/packages/workspace/src/browser/workspace-uri-contribution.ts index 3c0fa6387eff0..af861a2c1352c 100644 --- a/packages/workspace/src/browser/workspace-uri-contribution.ts +++ b/packages/workspace/src/browser/workspace-uri-contribution.ts @@ -42,7 +42,7 @@ export class WorkspaceUriLabelProviderContribution extends DefaultUriLabelProvid return 0; } - private getUri(element: URI | FileStat) { + private getUri(element: URI | FileStat): URI { if (FileStat.is(element)) { return new URI(element.uri); } diff --git a/packages/workspace/src/node/default-workspace-server.ts b/packages/workspace/src/node/default-workspace-server.ts index b2a9b632a109f..7d55ab0f4d616 100644 --- a/packages/workspace/src/node/default-workspace-server.ts +++ b/packages/workspace/src/node/default-workspace-server.ts @@ -67,7 +67,7 @@ export class DefaultWorkspaceServer implements WorkspaceServer { protected readonly cliParams: WorkspaceCliContribution; @postConstruct() - protected async init() { + protected async init(): Promise { const root = await this.getRoot(); this.root.resolve(root); }