Skip to content

Commit

Permalink
Merge branch 'main' into joh/vscode-dts
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Nov 10, 2021
2 parents f7ef737 + 2cc2bfc commit b9a2b0d
Show file tree
Hide file tree
Showing 12 changed files with 159 additions and 19 deletions.
2 changes: 1 addition & 1 deletion extensions/git/src/askpass.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
VSCODE_GIT_ASKPASS_PIPE=`mktemp`
ELECTRON_RUN_AS_NODE="1" VSCODE_GIT_ASKPASS_PIPE="$VSCODE_GIT_ASKPASS_PIPE" "$VSCODE_GIT_ASKPASS_NODE" "$VSCODE_GIT_ASKPASS_EXTRA_ARGS" "$VSCODE_GIT_ASKPASS_MAIN" $*
ELECTRON_RUN_AS_NODE="1" VSCODE_GIT_ASKPASS_PIPE="$VSCODE_GIT_ASKPASS_PIPE" "$VSCODE_GIT_ASKPASS_NODE" "$VSCODE_GIT_ASKPASS_MAIN" $VSCODE_GIT_ASKPASS_EXTRA_ARGS $*
cat $VSCODE_GIT_ASKPASS_PIPE
rm $VSCODE_GIT_ASKPASS_PIPE
2 changes: 1 addition & 1 deletion src/vs/base/browser/ui/grid/gridview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { $ } from 'vs/base/browser/dom';
import { Orientation, Sash } from 'vs/base/browser/ui/sash/sash';
import { ISplitViewStyles, IView as ISplitView, LayoutPriority, Sizing, SplitView } from 'vs/base/browser/ui/splitview/splitview';
import { DistributeSizing, ISplitViewStyles, IView as ISplitView, LayoutPriority, Sizing, SplitView } from 'vs/base/browser/ui/splitview/splitview';
import { equals as arrayEquals, tail2 as tail } from 'vs/base/common/arrays';
import { Color } from 'vs/base/common/color';
import { Emitter, Event, Relay } from 'vs/base/common/event';
Expand Down
84 changes: 84 additions & 0 deletions src/vs/base/node/ports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,90 @@ function doFindFreePort(startPort: number, giveUpAfter: number, stride: number,
client.connect(startPort, '127.0.0.1');
}

// Reference: https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/net/base/port_util.cc#56
export const BROWSER_RESTRICTED_PORTS: any = {
1: true, // tcpmux
7: true, // echo
9: true, // discard
11: true, // systat
13: true, // daytime
15: true, // netstat
17: true, // qotd
19: true, // chargen
20: true, // ftp data
21: true, // ftp access
22: true, // ssh
23: true, // telnet
25: true, // smtp
37: true, // time
42: true, // name
43: true, // nicname
53: true, // domain
69: true, // tftp
77: true, // priv-rjs
79: true, // finger
87: true, // ttylink
95: true, // supdup
101: true, // hostriame
102: true, // iso-tsap
103: true, // gppitnp
104: true, // acr-nema
109: true, // pop2
110: true, // pop3
111: true, // sunrpc
113: true, // auth
115: true, // sftp
117: true, // uucp-path
119: true, // nntp
123: true, // NTP
135: true, // loc-srv /epmap
137: true, // netbios
139: true, // netbios
143: true, // imap2
161: true, // snmp
179: true, // BGP
389: true, // ldap
427: true, // SLP (Also used by Apple Filing Protocol)
465: true, // smtp+ssl
512: true, // print / exec
513: true, // login
514: true, // shell
515: true, // printer
526: true, // tempo
530: true, // courier
531: true, // chat
532: true, // netnews
540: true, // uucp
548: true, // AFP (Apple Filing Protocol)
554: true, // rtsp
556: true, // remotefs
563: true, // nntp+ssl
587: true, // smtp (rfc6409)
601: true, // syslog-conn (rfc3195)
636: true, // ldap+ssl
989: true, // ftps-data
990: true, // ftps
993: true, // ldap+ssl
995: true, // pop3+ssl
1719: true, // h323gatestat
1720: true, // h323hostcall
1723: true, // pptp
2049: true, // nfs
3659: true, // apple-sasl / PasswordServer
4045: true, // lockd
5060: true, // sip
5061: true, // sips
6000: true, // X11
6566: true, // sane-port
6665: true, // Alternate IRC [Apple addition]
6666: true, // Alternate IRC [Apple addition]
6667: true, // Standard IRC [Apple addition]
6668: true, // Alternate IRC [Apple addition]
6669: true, // Alternate IRC [Apple addition]
6697: true, // IRC + TLS
10080: true // Amanda
};

/**
* Uses listen instead of connect. Is faster, but if there is another listener on 0.0.0.0 then this will take 127.0.0.1 from that listener.
*/
Expand Down
8 changes: 5 additions & 3 deletions src/vs/editor/common/viewLayout/viewLineRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,11 @@ function resolveRenderLineInput(input: RenderLineInput): ResolvedRenderLineInput
}

let tokens = transformAndRemoveOverflowing(input.lineTokens, input.fauxIndentLength, len);
if (input.renderControlCharacters && !input.isBasicASCII) {
// Calling `extractControlCharacters` before adding (possibly empty) line parts
// for inline decorations. `extractControlCharacters` removes empty line parts.
tokens = extractControlCharacters(lineContent, tokens);
}
if (input.renderWhitespace === RenderWhitespace.All ||
input.renderWhitespace === RenderWhitespace.Boundary ||
(input.renderWhitespace === RenderWhitespace.Selection && !!input.selectionsOnLine) ||
Expand All @@ -500,9 +505,6 @@ function resolveRenderLineInput(input: RenderLineInput): ResolvedRenderLineInput
// We can never split RTL text, as it ruins the rendering
tokens = splitLargeTokens(lineContent, tokens, !input.isBasicASCII || input.fontLigatures);
}
if (input.renderControlCharacters && !input.isBasicASCII) {
tokens = extractControlCharacters(lineContent, tokens);
}

return new ResolvedRenderLineInput(
input.useMonospaceOptimizations,
Expand Down
40 changes: 40 additions & 0 deletions src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,46 @@ suite('viewLineRenderer.renderLine 2', () => {
assert.deepStrictEqual(actual.html, expected);
});

test('issue #136622: Inline decorations are not rendering on non-ASCII lines when renderControlCharacters is on', () => {

let actual = renderViewLine(new RenderLineInput(
true,
true,
'some text £',
false,
false,
false,
0,
createViewLineTokens([createPart(11, 3)]),
[
new LineDecoration(5, 5, 'inlineDec1', InlineDecorationType.After),
new LineDecoration(6, 6, 'inlineDec2', InlineDecorationType.Before),
],
4,
0,
10,
10,
10,
10000,
'none',
true,
false,
null
));

let expected = [
'<span>',
'<span class="mtk3">some</span>',
'<span class="mtk3 inlineDec1"></span>',
'<span class="mtk3">\u00a0</span>',
'<span class="mtk3 inlineDec2"></span>',
'<span class="mtk3">text\u00a0£</span>',
'</span>'
].join('');

assert.deepStrictEqual(actual.html, expected);
});

test('issue #22832: Consider fullwidth characters when rendering tabs', () => {

let actual = renderViewLine(new RenderLineInput(
Expand Down
2 changes: 2 additions & 0 deletions src/vs/platform/remote/common/remoteAuthorityResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export interface ResolvedOptions {
export interface TunnelDescription {
remoteAddress: { port: number, host: string };
localAddress: { port: number, host: string } | string;
privacy?: string;
protocol?: string;
}
export interface TunnelInformation {
environmentTunnels?: TunnelDescription[];
Expand Down
16 changes: 13 additions & 3 deletions src/vs/platform/remote/node/tunnelService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import * as net from 'net';
import { findFreePortFaster } from 'vs/base/node/ports';
import { BROWSER_RESTRICTED_PORTS, findFreePortFaster } from 'vs/base/node/ports';
import { NodeSocket } from 'vs/base/parts/ipc/node/ipc.net';
import { nodeSocketFactory } from 'vs/platform/remote/node/nodeSocketFactory';

Expand All @@ -18,8 +18,18 @@ import { AbstractTunnelService, isAllInterfaces, ISharedTunnelsService as IShare
import { ISignService } from 'vs/platform/sign/common/sign';

async function createRemoteTunnel(options: IConnectionOptions, defaultTunnelHost: string, tunnelRemoteHost: string, tunnelRemotePort: number, tunnelLocalPort?: number): Promise<RemoteTunnel> {
const tunnel = new NodeRemoteTunnel(options, defaultTunnelHost, tunnelRemoteHost, tunnelRemotePort, tunnelLocalPort);
return tunnel.waitForReady();
let readyTunnel: NodeRemoteTunnel | undefined;
for (let attempts = 3; attempts; attempts--) {
if (readyTunnel) {
readyTunnel.dispose();
}
const tunnel = new NodeRemoteTunnel(options, defaultTunnelHost, tunnelRemoteHost, tunnelRemotePort, tunnelLocalPort);
readyTunnel = await tunnel.waitForReady();
if ((tunnelLocalPort && BROWSER_RESTRICTED_PORTS[tunnelLocalPort]) || !BROWSER_RESTRICTED_PORTS[readyTunnel.tunnelLocalPort]) {
break;
}
}
return readyTunnel!;
}

class NodeRemoteTunnel extends Disposable implements RemoteTunnel {
Expand Down
4 changes: 3 additions & 1 deletion src/vs/workbench/api/browser/mainThreadTunnelService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ export class MainThreadTunnelService extends Disposable implements MainThreadTun
return (await this.tunnelService.tunnels).map(tunnel => {
return {
remoteAddress: { port: tunnel.tunnelRemotePort, host: tunnel.tunnelRemoteHost },
localAddress: tunnel.localAddress
localAddress: tunnel.localAddress,
privacy: tunnel.privacy,
protocol: tunnel.protocol
};
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@

import { localize } from 'vs/nls';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { EditorAction, ServicesAccessor, registerEditorAction } from 'vs/editor/browser/editorExtensions';
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { CATEGORIES } from 'vs/workbench/common/actions';
import { Action2, registerAction2 } from 'vs/platform/actions/common/actions';

class InspectKeyMap extends EditorAction {
class InspectKeyMap extends Action2 {

constructor() {
super({
id: 'workbench.action.inspectKeyMappings',
label: localize('workbench.action.inspectKeyMap', "Developer: Inspect Key Mappings"),
alias: 'Developer: Inspect Key Mappings',
precondition: undefined
title: { value: localize('workbench.action.inspectKeyMap', "Inspect Key Mappings"), original: 'Inspect Key Mappings' },
category: CATEGORIES.Developer,
f1: true
});
}

Expand All @@ -30,7 +30,7 @@ class InspectKeyMap extends EditorAction {
}
}

registerEditorAction(InspectKeyMap);
registerAction2(InspectKeyMap);

class InspectKeyMapJSON extends Action2 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class NotebookEditorKernelManager extends Disposable {
getSelectedOrSuggestedKernel(notebook: INotebookTextModel): INotebookKernel | undefined {
// returns SELECTED or the ONLY available kernel
const info = this._notebookKernelService.getMatchingKernel(notebook);
return info.selected ?? info.suggestions[0];
return info.selected ?? (info.all.length === 1 ? info.all[0] : undefined);
}

async executeNotebookCells(notebook: INotebookTextModel, cells: Iterable<ICellViewModel>): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type { Terminal, IViewportRange, ILinkProvider } from 'xterm';
import { Schemas } from 'vs/base/common/network';
import { posix, win32 } from 'vs/base/common/path';
import { ITerminalExternalLinkProvider, ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal';
import { OperatingSystem, isMacintosh, OS, isWindows } from 'vs/base/common/platform';
import { OperatingSystem, isMacintosh, OS } from 'vs/base/common/platform';
import { IMarkdownString, MarkdownString } from 'vs/base/common/htmlContent';
import { TerminalProtocolLinkProvider } from 'vs/workbench/contrib/terminal/browser/links/terminalProtocolLinkProvider';
import { TerminalValidatedLocalLinkProvider, lineAndColumnClause, unixLocalLinkClause, winLocalLinkClause, winDrivePrefix, winLineAndColumnMatchIndex, unixLineAndColumnMatchIndex, lineAndColumnClauseGroupCount } from 'vs/workbench/contrib/terminal/browser/links/terminalValidatedLocalLinkProvider';
Expand Down Expand Up @@ -213,7 +213,7 @@ export class TerminalLinkManager extends DisposableStore {
if (uri.scheme === Schemas.file) {
// Just using fsPath here is unsafe: https://github.com/microsoft/vscode/issues/109076
const fsPath = uri.fsPath;
this._handleLocalLink(((this._osPath.sep === posix.sep) && isWindows) ? fsPath.replace(/\\/g, posix.sep) : fsPath);
this._handleLocalLink(((this._osPath.sep === posix.sep) && this._processManager.os === OperatingSystem.Windows) ? fsPath.replace(/\\/g, posix.sep) : fsPath);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/terminal/browser/terminalGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ export class TerminalGroup extends Disposable implements ITerminalGroup {
this._terminalInstances.splice(index, 0, instance);
if (this._splitPaneContainer) {
this._splitPaneContainer.remove(instance);
this._splitPaneContainer.split(instance, sourceIndex < index ? index - 1 : index);
this._splitPaneContainer.split(instance, index);
}
this._onInstancesChanged.fire();
}
Expand Down

0 comments on commit b9a2b0d

Please sign in to comment.