Skip to content

Commit 1837853

Browse files
committed
Merge branch 'master' into aeschli/sem-color-test
2 parents e23cbe0 + 7c5d945 commit 1837853

32 files changed

Lines changed: 155 additions & 181 deletions

File tree

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ This repository ("`Code - OSS`") is where we (Microsoft) develop the [Visual Stu
2222

2323
Visual Studio Code is updated monthly with new features and bug fixes. You can download it for Windows, macOS, and Linux on [Visual Studio Code's website](https://code.visualstudio.com/Download). To get the latest releases every day, install the [Insiders build](https://code.visualstudio.com/insiders).
2424

25-
26-
2725
## Contributing
2826

2927
There are many ways in which you can participate in the project, for example:
@@ -52,11 +50,11 @@ please see the document [How to Contribute](https://github.com/Microsoft/vscode/
5250

5351
## Related Projects
5452

55-
Many of the core components and extensions to Code live in their own repositories on GitHub. For example, the [node debug adapter](https://github.com/microsoft/vscode-node-debug) and the [mono debug adapter](https://github.com/microsoft/vscode-mono-debug) have their own repositories. For a complete list, please visit the [Related Projects](https://github.com/Microsoft/vscode/wiki/Related-Projects) page on our [wiki](https://github.com/Microsoft/vscode/wiki).
53+
Many of the core components and extensions to VS Code live in their own repositories on GitHub. For example, the [node debug adapter](https://github.com/microsoft/vscode-node-debug) and the [mono debug adapter](https://github.com/microsoft/vscode-mono-debug) have their own repositories. For a complete list, please visit the [Related Projects](https://github.com/Microsoft/vscode/wiki/Related-Projects) page on our [wiki](https://github.com/Microsoft/vscode/wiki).
5654

5755
## Bundled Extensions
5856

59-
Code includes a set of built-in extensions located in the [extensions](extensions) folder, including grammars and snippets for many languages. Extensions that provide rich language support (code completion, Go to Definition) for a language have the suffix `language-features`. For example, the `json` extension provides coloring for `JSON` and the `json-language-features` provides rich language support for `JSON`.
57+
VS Code includes a set of built-in extensions located in the [extensions](extensions) folder, including grammars and snippets for many languages. Extensions that provide rich language support (code completion, Go to Definition) for a language have the suffix `language-features`. For example, the `json` extension provides coloring for `JSON` and the `json-language-features` provides rich language support for `JSON`.
6058

6159
## Code of Conduct
6260

extensions/git/extension.webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ module.exports = withDefaults({
1313
context: __dirname,
1414
entry: {
1515
main: './src/main.ts',
16-
['askpass-main']: './src/askpass-main.ts'
16+
['askpass-main']: './src/askpass/askpass-main.ts'
1717
}
1818
});

extensions/git/package.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,12 +1608,6 @@
16081608
"default": "mixed",
16091609
"description": "%config.untrackedChanges%",
16101610
"scope": "resource"
1611-
},
1612-
"git.restoreCommitTemplateComments": {
1613-
"type": "boolean",
1614-
"scope": "resource",
1615-
"default": true,
1616-
"description": "%config.restoreCommitTemplateComments%"
16171611
}
16181612
}
16191613
},

extensions/git/package.nls.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@
139139
"config.untrackedChanges.mixed": "All changes, tracked and untracked, appear together and behave equally.",
140140
"config.untrackedChanges.separate": "Untracked changes appear separately in the Source Control view. They are also excluded from several actions.",
141141
"config.untrackedChanges.hidden": "Untracked changes are hidden and excluded from several actions.",
142-
"config.restoreCommitTemplateComments": "Controls whether to restore commit template comments in the commit input box.",
143142
"colors.added": "Color for added resources.",
144143
"colors.modified": "Color for modified resources.",
145144
"colors.deleted": "Color for deleted resources.",

extensions/git/src/commands.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,7 @@ export class CommandCenter {
14061406
const message = repository.inputBox.value;
14071407
const getCommitMessage = async () => {
14081408
let _message: string | undefined = message;
1409+
14091410
if (!_message) {
14101411
let value: string | undefined = undefined;
14111412

@@ -1430,7 +1431,7 @@ export class CommandCenter {
14301431
});
14311432
}
14321433

1433-
return _message ? repository.cleanUpCommitEditMessage(_message) : _message;
1434+
return _message;
14341435
};
14351436

14361437
const didCommit = await this.smartCommit(repository, getCommitMessage, opts);

extensions/git/src/git.ts

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import * as fs from 'fs';
6+
import { promises as fs, exists } from 'fs';
77
import * as path from 'path';
88
import * as os from 'os';
99
import * as cp from 'child_process';
1010
import * as which from 'which';
1111
import { EventEmitter } from 'events';
1212
import iconv = require('iconv-lite');
1313
import * as filetype from 'file-type';
14-
import { assign, groupBy, denodeify, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent, splitInChunks, Limiter } from './util';
14+
import { assign, groupBy, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent, splitInChunks, Limiter } from './util';
1515
import { CancellationToken, Progress } from 'vscode';
1616
import { URI } from 'vscode-uri';
1717
import { detectEncoding } from './encoding';
@@ -22,8 +22,6 @@ import { StringDecoder } from 'string_decoder';
2222
// https://github.com/microsoft/vscode/issues/65693
2323
const MAX_CLI_LENGTH = 30000;
2424

25-
const readfile = denodeify<string, string | null, string>(fs.readFile);
26-
2725
export interface IGit {
2826
path: string;
2927
version: string;
@@ -350,7 +348,7 @@ export class Git {
350348
let folderPath = path.join(parentPath, folderName);
351349
let count = 1;
352350

353-
while (count < 20 && await new Promise(c => fs.exists(folderPath, c))) {
351+
while (count < 20 && await new Promise(c => exists(folderPath, c))) {
354352
folderName = `${baseFolderName}-${count++}`;
355353
folderPath = path.join(parentPath, folderName);
356354
}
@@ -1812,26 +1810,17 @@ export class Repository {
18121810
}
18131811
}
18141812

1815-
cleanupCommitEditMessage(message: string): string {
1816-
// If the message is a single line starting with whitespace followed by `#`, just allow it.
1817-
if (/^\s*#[^\n]*$/.test(message)) {
1818-
return message;
1819-
}
1820-
1821-
// Else, remove all lines starting with whitespace followed by `#`.
1822-
// TODO: Support core.commentChar
1823-
return message.replace(/^(\s*#)(.*)$(\n?)/gm, (_, prefix, content, suffix) => {
1824-
// https://github.com/microsoft/vscode/issues/84201#issuecomment-552834814
1825-
return /^\d/.test(content) ? `${prefix}${content}${suffix}` : '';
1826-
}).trim();
1813+
// TODO: Support core.commentChar
1814+
stripCommitMessageComments(message: string): string {
1815+
return message.replace(/^\s*#.*$\n?/gm, '').trim();
18271816
}
18281817

18291818
async getMergeMessage(): Promise<string | undefined> {
18301819
const mergeMsgPath = path.join(this.repositoryRoot, '.git', 'MERGE_MSG');
18311820

18321821
try {
1833-
const raw = await readfile(mergeMsgPath, 'utf8');
1834-
return raw.trim();
1822+
const raw = await fs.readFile(mergeMsgPath, 'utf8');
1823+
return this.stripCommitMessageComments(raw);
18351824
} catch {
18361825
return undefined;
18371826
}
@@ -1854,9 +1843,8 @@ export class Repository {
18541843
templatePath = path.join(this.repositoryRoot, templatePath);
18551844
}
18561845

1857-
const raw = await readfile(templatePath, 'utf8');
1858-
return raw.trim();
1859-
1846+
const raw = await fs.readFile(templatePath, 'utf8');
1847+
return this.stripCommitMessageComments(raw);
18601848
} catch (err) {
18611849
return '';
18621850
}
@@ -1879,7 +1867,7 @@ export class Repository {
18791867
const gitmodulesPath = path.join(this.root, '.gitmodules');
18801868

18811869
try {
1882-
const gitmodulesRaw = await readfile(gitmodulesPath, 'utf8');
1870+
const gitmodulesRaw = await fs.readFile(gitmodulesPath, 'utf8');
18831871
return parseGitmodules(gitmodulesRaw);
18841872
} catch (err) {
18851873
if (/ENOENT/.test(err.message)) {

extensions/git/src/ipc/ipcServer.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { Disposable } from 'vscode';
7-
import { denodeify, toDisposable } from '../util';
7+
import { toDisposable } from '../util';
88
import * as path from 'path';
99
import * as http from 'http';
1010
import * as os from 'os';
1111
import * as fs from 'fs';
1212
import * as crypto from 'crypto';
1313

14-
const randomBytes = denodeify<Buffer>(crypto.randomBytes);
15-
1614
function getIPCHandlePath(nonce: string): string {
1715
if (process.platform === 'win32') {
1816
return `\\\\.\\pipe\\vscode-git-ipc-${nonce}-sock`;
@@ -31,7 +29,7 @@ export interface IIPCHandler {
3129

3230
export async function createIPCServer(): Promise<IIPCServer> {
3331
const server = http.createServer();
34-
const buffer = await randomBytes(20);
32+
const buffer = await new Promise<Buffer>((c, e) => crypto.randomBytes(20, (err, buf) => err ? e(err) : c(buf)));
3533
const nonce = buffer.toString('hex');
3634
const ipcHandlePath = getIPCHandlePath(nonce);
3735

extensions/git/src/repository.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -844,15 +844,7 @@ export class Repository implements Disposable {
844844
return mergeMessage;
845845
}
846846

847-
let template = await this.repository.getCommitTemplate();
848-
849-
const config = workspace.getConfiguration('git', Uri.file(this.root));
850-
851-
if (!config.get<boolean>('restoreCommitTemplateComments')) {
852-
template = this.cleanUpCommitEditMessage(template);
853-
}
854-
855-
return template;
847+
return await this.repository.getCommitTemplate();
856848
}
857849

858850
getConfigs(): Promise<{ key: string; value: string; }[]> {
@@ -1286,10 +1278,6 @@ export class Repository implements Disposable {
12861278
return await this.run(Operation.GetCommitTemplate, async () => this.repository.getCommitTemplate());
12871279
}
12881280

1289-
cleanUpCommitEditMessage(editMessage: string): string {
1290-
return this.repository.cleanupCommitEditMessage(editMessage);
1291-
}
1292-
12931281
async ignore(files: Uri[]): Promise<void> {
12941282
return await this.run(Operation.Ignore, async () => {
12951283
const ignoreFile = `${this.repository.root}${path.sep}.gitignore`;

extensions/git/src/util.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { Event } from 'vscode';
77
import { dirname, sep } from 'path';
88
import { Readable } from 'stream';
9-
import * as fs from 'fs';
9+
import { promises as fs, createReadStream } from 'fs';
1010
import * as byline from 'byline';
1111

1212
export function log(...args: any[]): void {
@@ -140,25 +140,14 @@ export function groupBy<T>(arr: T[], fn: (el: T) => string): { [key: string]: T[
140140
}, Object.create(null));
141141
}
142142

143-
export function denodeify<A, B, C, R>(fn: Function): (a: A, b: B, c: C) => Promise<R>;
144-
export function denodeify<A, B, R>(fn: Function): (a: A, b: B) => Promise<R>;
145-
export function denodeify<A, R>(fn: Function): (a: A) => Promise<R>;
146-
export function denodeify<R>(fn: Function): (...args: any[]) => Promise<R>;
147-
export function denodeify<R>(fn: Function): (...args: any[]) => Promise<R> {
148-
return (...args) => new Promise<R>((c, e) => fn(...args, (err: any, r: any) => err ? e(err) : c(r)));
149-
}
150-
151-
export function nfcall<R>(fn: Function, ...args: any[]): Promise<R> {
152-
return new Promise<R>((c, e) => fn(...args, (err: any, r: any) => err ? e(err) : c(r)));
153-
}
154143

155144
export async function mkdirp(path: string, mode?: number): Promise<boolean> {
156145
const mkdir = async () => {
157146
try {
158-
await nfcall(fs.mkdir, path, mode);
147+
await fs.mkdir(path, mode);
159148
} catch (err) {
160149
if (err.code === 'EEXIST') {
161-
const stat = await nfcall<fs.Stats>(fs.stat, path);
150+
const stat = await fs.stat(path);
162151

163152
if (stat.isDirectory()) {
164153
return;
@@ -232,7 +221,7 @@ export function find<T>(array: T[], fn: (t: T) => boolean): T | undefined {
232221

233222
export async function grep(filename: string, pattern: RegExp): Promise<boolean> {
234223
return new Promise<boolean>((c, e) => {
235-
const fileStream = fs.createReadStream(filename, { encoding: 'utf8' });
224+
const fileStream = createReadStream(filename, { encoding: 'utf8' });
236225
const stream = byline(fileStream);
237226
stream.on('data', (line: string) => {
238227
if (pattern.test(line)) {

src/vs/base/browser/dom.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ export let addStandardDisposableListener: IAddStandardDisposableListenerSignatur
267267
return addDisposableListener(node, type, wrapHandler, useCapture);
268268
};
269269

270+
export let addStandardDisposableGenericMouseDownListner = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {
271+
let wrapHandler = _wrapAsStandardMouseEvent(handler);
272+
273+
return addDisposableGenericMouseDownListner(node, wrapHandler, useCapture);
274+
};
275+
270276
export function addDisposableGenericMouseDownListner(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {
271277
return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture);
272278
}
@@ -506,7 +512,16 @@ export function getClientArea(element: HTMLElement): Dimension {
506512

507513
// If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight
508514
if (platform.isIOS && (<any>window).visualViewport) {
509-
return new Dimension((<any>window).visualViewport.width, (<any>window).visualViewport.height);
515+
const width = (<any>window).visualViewport.width;
516+
const height = (<any>window).visualViewport.height - (
517+
browser.isStandalone
518+
// in PWA mode, the visual viewport always includes the safe-area-inset-bottom (which is for the home indicator)
519+
// even when you are using the onscreen monitor, the visual viewport will include the area between system statusbar and the onscreen keyboard
520+
// plus the area between onscreen keyboard and the bottom bezel, which is 20px on iOS.
521+
? (20 + 4) // + 4px for body margin
522+
: 0
523+
);
524+
return new Dimension(width, height);
510525
}
511526

512527
// Try innerWidth / innerHeight

0 commit comments

Comments
 (0)