Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'terminal' extension typos #6692

Merged
merged 1 commit into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

Breaking changes:

- [core] new browser windows spawned through opener-service have noopener set, preventing them from accessing window.opener and giveing them their own event loop. openNewWindow will no longer return a Window as a result.
- [core] new browser windows spawned through opener-service have noopener set, preventing them from accessing window.opener and giving them their own event loop. openNewWindow will no longer return a Window as a result.
- [terminal] renamed `TerminalCopyOnSelectionHander` to `TerminalCopyOnSelectionHandler` [#6692](https://github.com/eclipse-theia/theia/pull/6692)

## v0.13.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { injectable, postConstruct } from 'inversify';
import { isFirefox } from '@theia/core/lib/browser';

@injectable()
export class TerminalCopyOnSelectionHander {
export class TerminalCopyOnSelectionHandler {

private textToCopy: string;
private interceptCopy: boolean;
Expand All @@ -36,18 +36,18 @@ export class TerminalCopyOnSelectionHander {
}

private async clipBoardCopyIsGranted(): Promise<boolean> {
// Unfortunately Firefox doesn't support permission check `clipboard-write`, so let try to copy anyway,
if (isFirefox) {
// Unfortunately Firefox doesn't support permission check `clipboard-write`, so let try to copy anyway,
if (isFirefox) {
return true;
}
try {
// tslint:disable-next-line:no-any
const permissions = (navigator as any).permissions;
const { state } = await permissions.query({name: 'clipboard-write'});
const { state } = await permissions.query({ name: 'clipboard-write' });
if (state === 'granted') {
return true;
}
} catch (e) {}
} catch (e) { }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor]: you could omit e.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I tried your suggestion and it looks like it complains:

Screen Shot 2019-12-05 at 8 06 15 AM

I'll keep it as is for the moment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, for the next time; the syntax is try { } catch { } finally { } or try { } catch (e) { } finally { }


return false;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/terminal/src/browser/terminal-frontend-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { TerminalQuickOpenService, TerminalQuickOpenContribution } from './termi

import '../../src/browser/terminal.css';
import 'xterm/lib/xterm.css';
import { TerminalCopyOnSelectionHander } from './terminal-copy-on-selection-handler';
import { TerminalCopyOnSelectionHandler } from './terminal-copy-on-selection-handler';

export default new ContainerModule(bind => {
bindTerminalPreferences(bind);
Expand Down Expand Up @@ -68,7 +68,7 @@ export default new ContainerModule(bind => {
}));

bind(TerminalQuickOpenService).toSelf().inSingletonScope();
bind(TerminalCopyOnSelectionHander).toSelf().inSingletonScope();
bind(TerminalCopyOnSelectionHandler).toSelf().inSingletonScope();

bind(TerminalQuickOpenContribution).toSelf().inSingletonScope();
for (const identifier of [CommandContribution, QuickOpenContribution]) {
Expand Down
6 changes: 3 additions & 3 deletions packages/terminal/src/browser/terminal-linkmatcher-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class TerminalLinkmatcherFiles extends AbstractCmdClickTerminalContributi
}
}

// below reg exps are taken from
// The following regular expressions are taken from:
// https://github.com/microsoft/vscode/blob/fbbc1aa80332189aa0d3006cb2159b79a9eba480/src/vs/workbench/contrib/terminal/browser/terminalLinkHandler.ts

/*---------------------------------------------------------------------------------------------
Expand All @@ -142,7 +142,7 @@ export class TerminalLinkmatcherFiles extends AbstractCmdClickTerminalContributi
const pathPrefix = '(\\.\\.?|\\~)';
const pathSeparatorClause = '\\/';
// '":; are allowed in paths but they are often separators so ignore them
// Also disallow \\ to prevent a catastropic backtracking case #24798
// Also disallow \\ to prevent a catastrophic backtracking case #24798
const excludedPathCharactersClause = '[^\\0\\s!$`&*()\\[\\]+\'":;\\\\]';
/** A regex that matches paths in the form /foo, ~/foo, ./foo, ../foo, foo/bar */
const unixLocalLinkClause = '((' + pathPrefix + '|(' + excludedPathCharactersClause + ')+)?(' + pathSeparatorClause + '(' + excludedPathCharactersClause + ')+)+)';
Expand All @@ -154,7 +154,7 @@ const winExcludedPathCharactersClause = '[^\\0<>\\?\\|\\/\\s!$`&*()\\[\\]+\'":;]
/** A regex that matches paths in the form c:\foo, ~\foo, .\foo, ..\foo, foo\bar */
const winLocalLinkClause = '((' + winPathPrefix + '|(' + winExcludedPathCharactersClause + ')+)?(' + winPathSeparatorClause + '(' + winExcludedPathCharactersClause + ')+)+)';

/** As xterm reads from DOM, space in that case is nonbreaking char ASCII code - 160, replacing space with nonBreakningSpace or space ASCII code - 32. */
/** As xterm reads from DOM, space in that case is non-breaking char ASCII code - 160, replacing space with nonBreakingSpace or space ASCII code - 32. */
const lineAndColumnClause = [
// "(file path)", line 45 [see #40468]
'((\\S*)", line ((\\d+)( column (\\d+))?))',
Expand Down
4 changes: 2 additions & 2 deletions packages/terminal/src/browser/terminal-widget-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { TerminalPreferences, TerminalRendererType, isTerminalRendererType, DEFA
import { TerminalContribution } from './terminal-contribution';
import URI from '@theia/core/lib/common/uri';
import { TerminalService } from './base/terminal-service';
import { TerminalCopyOnSelectionHander } from './terminal-copy-on-selection-handler';
import { TerminalCopyOnSelectionHandler } from './terminal-copy-on-selection-handler';

export const TERMINAL_WIDGET_FACTORY_ID = 'terminal';

Expand Down Expand Up @@ -76,7 +76,7 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
@inject(TerminalPreferences) protected readonly preferences: TerminalPreferences;
@inject(ContributionProvider) @named(TerminalContribution) protected readonly terminalContributionProvider: ContributionProvider<TerminalContribution>;
@inject(TerminalService) protected readonly terminalService: TerminalService;
@inject(TerminalCopyOnSelectionHander) protected readonly copyOnSelectionHandler: TerminalCopyOnSelectionHander;
@inject(TerminalCopyOnSelectionHandler) protected readonly copyOnSelectionHandler: TerminalCopyOnSelectionHandler;

protected readonly onDidOpenEmitter = new Emitter<void>();
readonly onDidOpen: Event<void> = this.onDidOpenEmitter.event;
Expand Down
2 changes: 1 addition & 1 deletion packages/terminal/src/node/terminal-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { ITerminalServer } from '../common/terminal-protocol';

const expect = chai.expect;

describe('TermninalServer', function (): void {
describe('TerminalServer', function (): void {

this.timeout(5000);
let terminalServer: ITerminalServer;
Expand Down