Skip to content

Commit

Permalink
Rebase against the upstream e87dc37
Browse files Browse the repository at this point in the history
vscode-upstream-sha1: e87dc37
  • Loading branch information
Eclipse Che Sync committed Jul 20, 2023
2 parents 433b226 + e87dc37 commit f41fc7c
Show file tree
Hide file tree
Showing 26 changed files with 403 additions and 70 deletions.
4 changes: 2 additions & 2 deletions code/build/azure-pipelines/win32/product-build-win32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ steps:

- template: ../common/install-builtin-extensions.yml

- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
- ${{ if and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'oss')) }}:
- powershell: node build\lib\policies
displayName: Generate Group Policy definitions
retryCountOnTaskFailure: 3
Expand All @@ -148,7 +148,7 @@ steps:
displayName: Transpile

- ${{ else }}:
- ${{ if eq(parameters.VSCODE_QUALITY, 'insider') }}:
- ${{ if and(ne(parameters.VSCODE_CIBUILD, true), eq(parameters.VSCODE_QUALITY, 'insider')) }}:
- powershell: node build/win32/explorer-appx-fetcher .build/win32/appx
displayName: Download Explorer Sparse Package

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function r(startLine: number, endLine: number, kind?: string): ExpectedIndentRan
return { startLine, endLine, kind };
}

suite('HTML Folding', async () => {
suite('HTML Folding', () => {

test('Embedded JavaScript', async () => {
const input = [
Expand Down
9 changes: 5 additions & 4 deletions code/extensions/java/cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
"component": {
"type": "git",
"git": {
"name": "atom/language-java",
"repositoryUrl": "https://github.com/atom/language-java",
"commitHash": "29f977dc42a7e2568b39bb6fb34c4ef108eb59b3"
"name": "redhat-developer/vscode-java",
"repositoryUrl": "https://github.com/redhat-developer/vscode-java",
"commitHash": "7a770ab6750b4b09173d98de14eb9792e3432b36"
}
},
"license": "MIT",
"version": "0.32.1"
"description": "This grammar was derived from https://github.com/atom/language-java/blob/master/grammars/java.cson.",
"version": "1.21.0"
}
],
"version": 1
Expand Down
2 changes: 1 addition & 1 deletion code/extensions/java/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"vscode": "*"
},
"scripts": {
"update-grammar": "node ../node_modules/vscode-grammar-updater/bin atom/language-java grammars/java.cson ./syntaxes/java.tmLanguage.json"
"update-grammar": "node ../node_modules/vscode-grammar-updater/bin redhat-developer/vscode-java language-support/java/java.tmLanguage.json ./syntaxes/java.tmLanguage.json"
},
"contributes": {
"languages": [
Expand Down
32 changes: 30 additions & 2 deletions code/extensions/java/syntaxes/java.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"information_for_contributors": [
"This file has been converted from https://github.com/atom/language-java/blob/master/grammars/java.cson",
"This file has been converted from https://github.com/redhat-developer/vscode-java/blob/master/language-support/java/java.tmLanguage.json",
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/atom/language-java/commit/29f977dc42a7e2568b39bb6fb34c4ef108eb59b3",
"version": "https://github.com/redhat-developer/vscode-java/commit/7a770ab6750b4b09173d98de14eb9792e3432b36",
"name": "Java",
"scopeName": "source.java",
"patterns": [
Expand Down Expand Up @@ -1571,6 +1571,31 @@
},
"strings": {
"patterns": [
{
"begin": "\"\"\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.java"
}
},
"end": "\"\"\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.java"
}
},
"name": "string.quoted.triple.java",
"patterns": [
{
"match": "\\\\\"\"\"",
"name": "constant.character.escape.java"
},
{
"match": "\\\\.",
"name": "constant.character.escape.java"
}
]
},
{
"begin": "\"",
"beginCaptures": {
Expand Down Expand Up @@ -1632,6 +1657,9 @@
{
"match": "[a-zA-Z$_][\\.a-zA-Z0-9$_]*",
"name": "storage.type.java"
},
{
"include": "#comments"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@

import { Codicon } from 'vs/base/common/codicons';
import { ThemeIcon } from 'vs/base/common/themables';
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { EditorAction2, ServicesAccessor } from 'vs/editor/browser/editorExtensions';
import { findFocusedDiffEditor } from 'vs/editor/browser/widget/diffEditor.contribution';
import { DiffEditorWidget2 } from 'vs/editor/browser/widget/diffEditorWidget2/diffEditorWidget2';
import { localize } from 'vs/nls';
import { ILocalizedString } from 'vs/platform/action/common/action';
import { Action2, MenuId, MenuRegistry, registerAction2 } from 'vs/platform/actions/common/actions';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ContextKeyEqualsExpr, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
Expand Down Expand Up @@ -88,3 +92,29 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
group: '1_diff',
when: ContextKeyEqualsExpr.create('diffEditorVersion', 2)
});

const diffEditorCategory: ILocalizedString = {
value: localize('diffEditor', 'Diff Editor'),
original: 'Diff Editor',
};
export class SwitchSide extends EditorAction2 {
constructor() {
super({
id: 'diffEditor.switchSide',
title: { value: localize('switchSide', "Switch Side"), original: 'Switch Side' },
icon: Codicon.arrowSwap,
precondition: ContextKeyExpr.and(ContextKeyEqualsExpr.create('diffEditorVersion', 2), ContextKeyExpr.has('isInDiffEditor')),
f1: true,
category: diffEditorCategory,
});
}

runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, ...args: unknown[]): void {
const diffEditor = findFocusedDiffEditor(accessor);
if (diffEditor instanceof DiffEditorWidget2) {
diffEditor.switchSide();
}
}
}

registerAction2(SwitchSide);
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import { DiffEditorViewModel, DiffMapping, DiffState } from './diffEditorViewMod
import { AccessibleDiffViewer } from 'vs/editor/browser/widget/diffEditorWidget2/accessibleDiffViewer';
import { CursorChangeReason } from 'vs/editor/common/cursorEvents';
import { AudioCue, IAudioCueService } from 'vs/platform/audioCues/browser/audioCueService';
import { LengthObj } from 'vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/length';
import { Range } from 'vs/editor/common/core/range';

export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
private readonly elements = h('div.monaco-diff-editor.side-by-side', { style: { position: 'relative', height: '100%' } }, [
Expand Down Expand Up @@ -479,6 +481,71 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
if (!diffModel) { return; }
await diffModel.waitForDiff();
}

switchSide(): void {
const isModifiedFocus = this._editors.modified.hasWidgetFocus();
const source = isModifiedFocus ? this._editors.modified : this._editors.original;
const destination = isModifiedFocus ? this._editors.original : this._editors.modified;

const sourceSelection = source.getSelection();
if (sourceSelection) {
const mappings = this._diffModel.get()?.diff.get()?.mappings.map(m => isModifiedFocus ? m.lineRangeMapping.flip() : m.lineRangeMapping);
if (mappings) {
const newRange1 = translatePosition(sourceSelection.getStartPosition(), mappings);
const newRange2 = translatePosition(sourceSelection.getEndPosition(), mappings);
const range = Range.plusRange(newRange1, newRange2);
destination.setSelection(range);
}
}
destination.focus();
}
}

function translatePosition(posInOriginal: Position, mappings: LineRangeMapping[]): Range {
const mapping = findLast(mappings, m => m.originalRange.startLineNumber <= posInOriginal.lineNumber);
if (!mapping) {
// No changes before the position
return Range.fromPositions(posInOriginal);
}

if (mapping.originalRange.endLineNumberExclusive <= posInOriginal.lineNumber) {
const newLineNumber = posInOriginal.lineNumber - mapping.originalRange.endLineNumberExclusive + mapping.modifiedRange.endLineNumberExclusive;
return Range.fromPositions(new Position(newLineNumber, posInOriginal.column));
}

if (!mapping.innerChanges) {
// Only for legacy algorithm
return Range.fromPositions(new Position(mapping.modifiedRange.startLineNumber, 1));
}

const innerMapping = findLast(mapping.innerChanges, m => m.originalRange.getStartPosition().isBeforeOrEqual(posInOriginal));
if (!innerMapping) {
const newLineNumber = posInOriginal.lineNumber - mapping.originalRange.startLineNumber + mapping.modifiedRange.startLineNumber;
return Range.fromPositions(new Position(newLineNumber, posInOriginal.column));
}

if (innerMapping.originalRange.containsPosition(posInOriginal)) {
return innerMapping.modifiedRange;
} else {
const l = lengthBetweenPositions(innerMapping.originalRange.getEndPosition(), posInOriginal);
return Range.fromPositions(addLength(innerMapping.modifiedRange.getEndPosition(), l));
}
}

function lengthBetweenPositions(position1: Position, position2: Position): LengthObj {
if (position1.lineNumber === position2.lineNumber) {
return new LengthObj(0, position2.column - position1.column);
} else {
return new LengthObj(position2.lineNumber - position1.lineNumber, position2.column - 1);
}
}

function addLength(position: Position, length: LengthObj): Position {
if (length.lineCount === 0) {
return new Position(position.lineNumber, position.column + length.columnCount);
} else {
return new Position(position.lineNumber + length.lineCount, length.columnCount + 1);
}
}

function toLineChanges(state: DiffState): ILineChange[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ export class ViewZoneManager extends Disposable {
const diff = diffModel?.diff.read(reader);
if (!diffModel || !diff) { return null; }
state.read(reader);
return computeRangeAlignment(this._editors.original, this._editors.modified, diff.mappings, alignmentViewZoneIdsOrig, alignmentViewZoneIdsMod);
const renderSideBySide = this._options.renderSideBySide.read(reader);
const innerHunkAlignment = renderSideBySide;
return computeRangeAlignment(this._editors.original, this._editors.modified, diff.mappings, alignmentViewZoneIdsOrig, alignmentViewZoneIdsMod, innerHunkAlignment);
});

const alignmentsSyncedMovedText = derived<ILineRangeAlignment[] | null>('alignments', (reader) => {
Expand All @@ -94,7 +96,7 @@ export class ViewZoneManager extends Disposable {
state.read(reader);
const mappings = syncedMovedText.changes.map(c => new DiffMapping(c));
// TODO dont include alignments outside syncedMovedText
return computeRangeAlignment(this._editors.original, this._editors.modified, mappings, alignmentViewZoneIdsOrig, alignmentViewZoneIdsMod);
return computeRangeAlignment(this._editors.original, this._editors.modified, mappings, alignmentViewZoneIdsOrig, alignmentViewZoneIdsMod, true);
});

function createFakeLinesDiv(): HTMLElement {
Expand Down Expand Up @@ -455,6 +457,7 @@ function computeRangeAlignment(
diffs: readonly DiffMapping[],
originalEditorAlignmentViewZones: ReadonlySet<string>,
modifiedEditorAlignmentViewZones: ReadonlySet<string>,
innerHunkAlignment: boolean,
): ILineRangeAlignment[] {
const originalLineHeightOverrides = new ArrayQueue(getAdditionalLineHeights(originalEditor, originalEditorAlignmentViewZones));
const modifiedLineHeightOverrides = new ArrayQueue(getAdditionalLineHeights(modifiedEditor, modifiedEditorAlignmentViewZones));
Expand Down Expand Up @@ -546,18 +549,21 @@ function computeRangeAlignment(
modifiedRange,
originalHeightInPx: originalRange.length * origLineHeight + originalAdditionalHeight,
modifiedHeightInPx: modifiedRange.length * modLineHeight + modifiedAdditionalHeight,
diff: m.lineRangeMapping,
});

lastOrigLineNumber = origLineNumberExclusive;
lastModLineNumber = modLineNumberExclusive;
}

for (const i of c.innerChanges || []) {
if (i.originalRange.startColumn > 1 && i.modifiedRange.startColumn > 1) {
// There is some unmodified text on this line
emitAlignment(i.originalRange.startLineNumber, i.modifiedRange.startLineNumber);
if (innerHunkAlignment) {
for (const i of c.innerChanges || []) {
if (i.originalRange.startColumn > 1 && i.modifiedRange.startColumn > 1) {
// There is some unmodified text on this line
emitAlignment(i.originalRange.startLineNumber, i.modifiedRange.startLineNumber);
}
emitAlignment(i.originalRange.endLineNumber, i.modifiedRange.endLineNumber);
}
emitAlignment(i.originalRange.endLineNumber, i.modifiedRange.endLineNumber);
}

emitAlignment(c.originalRange.endLineNumberExclusive, c.modifiedRange.endLineNumberExclusive);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,13 @@ export class UpToDateInlineCompletions implements IDisposable {
public dispose(): void {
this._refCount--;
if (this._refCount === 0) {
this.textModel.deltaDecorations(this._inlineCompletions.map(i => i.decorationId), []);
setTimeout(() => {
// To fix https://github.com/microsoft/vscode/issues/188348
if (!this.textModel.isDisposed()) {
// This is just cleanup. It's ok if it happens with a delay.
this.textModel.deltaDecorations(this._inlineCompletions.map(i => i.decorationId), []);
}
}, 0);
this.inlineCompletionProviderResult.dispose();
for (const i of this._prependedInlineCompletionItems) {
i.source.removeRef();
Expand Down
5 changes: 5 additions & 0 deletions code/src/vs/platform/request/common/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ function registerProxyConfigurations(scope: ConfigurationScope): void {
description: localize('strictSSL', "Controls whether the proxy server certificate should be verified against the list of supplied CAs."),
restricted: true
},
'http.proxyKerberosServicePrincipal': {
type: 'string',
markdownDescription: localize('proxyKerberosServicePrincipal', "Overrides the principal service name for Kerberos authentication with the HTTP proxy. A default based on the proxy hostname is used when this is not set."),
restricted: true
},
'http.proxyAuthorization': {
type: ['null', 'string'],
default: null,
Expand Down
11 changes: 8 additions & 3 deletions code/src/vs/platform/tunnel/common/tunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export interface ITunnelProvider {
forwardPort(tunnelOptions: TunnelOptions, tunnelCreationOptions: TunnelCreationOptions): Promise<RemoteTunnel | undefined> | undefined;
}

export function isTunnelProvider(addressOrTunnelProvider: IAddressProvider | ITunnelProvider): addressOrTunnelProvider is ITunnelProvider {
return !!(addressOrTunnelProvider as ITunnelProvider).forwardPort;
}

export enum ProvidedOnAutoForward {
Notify = 1,
OpenBrowser = 2,
Expand Down Expand Up @@ -315,7 +319,8 @@ export abstract class AbstractTunnelService implements ITunnelService {

openTunnel(addressProvider: IAddressProvider | undefined, remoteHost: string | undefined, remotePort: number, localHost?: string, localPort?: number, elevateIfNeeded: boolean = false, privacy?: string, protocol?: string): Promise<RemoteTunnel | undefined> | undefined {
this.logService.trace(`ForwardedPorts: (TunnelService) openTunnel request for ${remoteHost}:${remotePort} on local port ${localPort}.`);
if (!addressProvider) {
const addressOrTunnelProvider = this._tunnelProvider ?? addressProvider;
if (!addressOrTunnelProvider) {
return undefined;
}

Expand All @@ -332,7 +337,7 @@ export abstract class AbstractTunnelService implements ITunnelService {
return;
}

const resolvedTunnel = this.retainOrCreateTunnel(addressProvider, remoteHost, remotePort, localHost, localPort, elevateIfNeeded, privacy, protocol);
const resolvedTunnel = this.retainOrCreateTunnel(addressOrTunnelProvider, remoteHost, remotePort, localHost, localPort, elevateIfNeeded, privacy, protocol);
if (!resolvedTunnel) {
this.logService.trace(`ForwardedPorts: (TunnelService) Tunnel was not created.`);
return resolvedTunnel;
Expand Down Expand Up @@ -454,7 +459,7 @@ export abstract class AbstractTunnelService implements ITunnelService {

public abstract isPortPrivileged(port: number): boolean;

protected abstract retainOrCreateTunnel(addressProvider: IAddressProvider, remoteHost: string, remotePort: number, localHost: string, localPort: number | undefined, elevateIfNeeded: boolean, privacy?: string, protocol?: string): Promise<RemoteTunnel | undefined> | undefined;
protected abstract retainOrCreateTunnel(addressProvider: IAddressProvider | ITunnelProvider, remoteHost: string, remotePort: number, localHost: string, localPort: number | undefined, elevateIfNeeded: boolean, privacy?: string, protocol?: string): Promise<RemoteTunnel | undefined> | undefined;

protected createWithProvider(tunnelProvider: ITunnelProvider, remoteHost: string, remotePort: number, localPort: number | undefined, elevateIfNeeded: boolean, privacy?: string, protocol?: string): Promise<RemoteTunnel | undefined> | undefined {
this.logService.trace(`ForwardedPorts: (TunnelService) Creating tunnel with provider ${remoteHost}:${remotePort} on local port ${localPort}.`);
Expand Down
10 changes: 5 additions & 5 deletions code/src/vs/platform/tunnel/node/tunnelService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { ILogService } from 'vs/platform/log/common/log';
import { IProductService } from 'vs/platform/product/common/productService';
import { connectRemoteAgentTunnel, IAddressProvider, IConnectionOptions } from 'vs/platform/remote/common/remoteAgentConnection';
import { AbstractTunnelService, isAllInterfaces, ISharedTunnelsService as ISharedTunnelsService, isLocalhost, isPortPrivileged, ITunnelService, RemoteTunnel, TunnelPrivacyId } from 'vs/platform/tunnel/common/tunnel';
import { AbstractTunnelService, isAllInterfaces, ISharedTunnelsService as ISharedTunnelsService, isLocalhost, isPortPrivileged, isTunnelProvider, ITunnelProvider, ITunnelService, RemoteTunnel, TunnelPrivacyId } from 'vs/platform/tunnel/common/tunnel';
import { ISignService } from 'vs/platform/sign/common/sign';
import { OS } from 'vs/base/common/platform';
import { IRemoteSocketFactoryService } from 'vs/platform/remote/common/remoteSocketFactoryService';
Expand Down Expand Up @@ -168,21 +168,21 @@ export class BaseTunnelService extends AbstractTunnelService {
return isPortPrivileged(port, this.defaultTunnelHost, OS, os.release());
}

protected retainOrCreateTunnel(addressProvider: IAddressProvider, remoteHost: string, remotePort: number, localHost: string, localPort: number | undefined, elevateIfNeeded: boolean, privacy?: string, protocol?: string): Promise<RemoteTunnel | undefined> | undefined {
protected retainOrCreateTunnel(addressOrTunnelProvider: IAddressProvider | ITunnelProvider, remoteHost: string, remotePort: number, localHost: string, localPort: number | undefined, elevateIfNeeded: boolean, privacy?: string, protocol?: string): Promise<RemoteTunnel | undefined> | undefined {
const existing = this.getTunnelFromMap(remoteHost, remotePort);
if (existing) {
++existing.refcount;
return existing.value;
}

if (this._tunnelProvider) {
return this.createWithProvider(this._tunnelProvider, remoteHost, remotePort, localPort, elevateIfNeeded, privacy, protocol);
if (isTunnelProvider(addressOrTunnelProvider)) {
return this.createWithProvider(addressOrTunnelProvider, remoteHost, remotePort, localPort, elevateIfNeeded, privacy, protocol);
} else {
this.logService.trace(`ForwardedPorts: (TunnelService) Creating tunnel without provider ${remoteHost}:${remotePort} on local port ${localPort}.`);
const options: IConnectionOptions = {
commit: this.productService.commit,
quality: this.productService.quality,
addressProvider,
addressProvider: addressOrTunnelProvider,
remoteSocketFactoryService: this.remoteSocketFactoryService,
signService: this.signService,
logService: this.logService,
Expand Down
Loading

0 comments on commit f41fc7c

Please sign in to comment.