Skip to content
Closed

test #49

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
63 changes: 63 additions & 0 deletions build/azure-pipelines/os-monaco-core-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
pool:
vmImage: 'windows-2019'

trigger:
branches:
include:
- main-os
pr: none

variables:
TagName: 'v$(Build.BuildNumber)'

stages:
- stage: Build
displayName: 'Build'
jobs:
- job: Build
displayName: 'Build Job'
steps:
- task: NodeTool@0
inputs:
versionSpec: "14.17.3"
- script: |
yarn
- script: |
./node_modules/.bin/gulp editor-distro
- task: PublishPipelineArtifact@1
inputs:
targetPath: './out-monaco-editor-core'
artifact: 'artifacts'
publishLocation: 'pipeline'


- stage: Deploy
displayName: 'Deploy'
jobs:
- deployment: Deploy
displayName: 'Deploy to npm private repository and creates a git release'
pool:
vmImage: 'windows-2019'
environment: Automatic-Release
strategy:
runOnce:
deploy:
steps:
#Creates a Github release
- task: GitHubRelease@1
inputs:
gitHubConnection: 'GitHub Release'
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'userSpecifiedTag'
tag: '$(TagName)'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'
#Publishes the package into the private artifact repository
- task: Npm@1
inputs:
command: 'publish'
workingDir: '$(Pipeline.Workspace)/artifacts/'
publishRegistry: 'useFeed'
publishFeed: 'd8b4d1eb-aeb3-4b5b-9b43-37b4fc985e2f'
25 changes: 25 additions & 0 deletions build/lib/treeshaking.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,28 @@ function nodeOrChildIsBlack(node) {
function isSymbolWithDeclarations(symbol) {
return !!(symbol && symbol.declarations);
}
function isVariableStatementWithSideEffects(ts, node) {
if (!ts.isVariableStatement(node)) {
return false;
}
let hasSideEffects = false;
const visitNode = (node) => {
if (hasSideEffects) {
// no need to go on
return;
}
if (ts.isCallExpression(node)) {
// TODO: assuming `createDecorator` and `refineServiceDecorator` calls are side-effect free
const isSideEffectFree = /(createDecorator|refineServiceDecorator)/.test(node.getText());
if (!isSideEffectFree) {
hasSideEffects = true;
}
}
node.forEachChild(visitNode);
};
node.forEachChild(visitNode);
return hasSideEffects;
}
function markNodes(ts, languageService, options) {
const program = languageService.getProgram();
if (!program) {
Expand Down Expand Up @@ -282,6 +304,9 @@ function markNodes(ts, languageService, options) {
}
return;
}
if (isVariableStatementWithSideEffects(ts, node)) {
enqueue_black(node);
}
if (ts.isExpressionStatement(node)
|| ts.isIfStatement(node)
|| ts.isIterationStatement(node, true)
Expand Down
27 changes: 27 additions & 0 deletions build/lib/treeshaking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,29 @@ function isSymbolWithDeclarations(symbol: ts.Symbol | undefined | null): symbol
return !!(symbol && symbol.declarations);
}

function isVariableStatementWithSideEffects(ts: typeof import('typescript'), node: ts.Node): boolean {
if (!ts.isVariableStatement(node)) {
return false;
}
let hasSideEffects = false;
const visitNode = (node: ts.Node) => {
if (hasSideEffects) {
// no need to go on
return;
}
if (ts.isCallExpression(node)) {
// TODO: assuming `createDecorator` and `refineServiceDecorator` calls are side-effect free
const isSideEffectFree = /(createDecorator|refineServiceDecorator)/.test(node.getText());
if (!isSideEffectFree) {
hasSideEffects = true;
}
}
node.forEachChild(visitNode);
};
node.forEachChild(visitNode);
return hasSideEffects;
}

function markNodes(ts: typeof import('typescript'), languageService: ts.LanguageService, options: ITreeShakingOptions) {
const program = languageService.getProgram();
if (!program) {
Expand Down Expand Up @@ -372,6 +395,10 @@ function markNodes(ts: typeof import('typescript'), languageService: ts.Language
return;
}

if (isVariableStatementWithSideEffects(ts, node)) {
enqueue_black(node);
}

if (
ts.isExpressionStatement(node)
|| ts.isIfStatement(node)
Expand Down
2 changes: 1 addition & 1 deletion build/monaco/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "monaco-editor-core",
"private": true,
"version": "0.31.0",
"version": "0.31.1-os2",
"description": "A browser based code editor",
"author": "Microsoft Corporation",
"license": "MIT",
Expand Down
19 changes: 19 additions & 0 deletions src/vs/base/common/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface INodeProcess {
platform: string;
arch: string;
env: IProcessEnvironment;
nextTick?: (callback: (...args: any[]) => void) => void;
versions?: {
electron?: string;
};
Expand Down Expand Up @@ -189,6 +190,10 @@ export const locale = _locale;
*/
export const translationsConfigFile = _translationsConfigFile;

interface ISetImmediate {
(callback: (...args: unknown[]) => void): void;
}

/**
* See https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#:~:text=than%204%2C%20then-,set%20timeout%20to%204,-.
*
Expand Down Expand Up @@ -227,6 +232,20 @@ export const setTimeout0 = (() => {
return (callback: () => void) => setTimeout(callback);
})();

export const setImmediate: ISetImmediate = (function defineSetImmediate() {
if (globals.setImmediate) {
return globals.setImmediate.bind(globals);
}
if (typeof globals.postMessage === 'function' && !globals.importScripts) {
return setTimeout0;
}
if (typeof nodeProcess?.nextTick === 'function') {
return nodeProcess.nextTick.bind(nodeProcess);
}
const _promise = Promise.resolve();
return (callback: (...args: unknown[]) => void) => _promise.then(callback);
})();

export const enum OperatingSystem {
Windows = 1,
Macintosh = 2,
Expand Down
10 changes: 8 additions & 2 deletions src/vs/editor/browser/controller/mouseTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -991,8 +991,14 @@ export function shadowCaretRangeFromPoint(shadowRoot: ShadowRoot, x: number, y:
// Grab its rect
const rect = el.getBoundingClientRect();

// And its font
const font = window.getComputedStyle(el, null).getPropertyValue('font');
// And its font (the computed shorthand font property might be empty, see #3217)
const fontStyle = window.getComputedStyle(el, null).getPropertyValue('font-style');
const fontVariant = window.getComputedStyle(el, null).getPropertyValue('font-variant');
const fontWeight = window.getComputedStyle(el, null).getPropertyValue('font-weight');
const fontSize = window.getComputedStyle(el, null).getPropertyValue('font-size');
const lineHeight = window.getComputedStyle(el, null).getPropertyValue('line-height');
const fontFamily = window.getComputedStyle(el, null).getPropertyValue('font-family');
const font = `${fontStyle} ${fontVariant} ${fontWeight} ${fontSize}/${lineHeight} ${fontFamily}`;

// And also its txt content
const text = (el as any).innerText;
Expand Down
10 changes: 5 additions & 5 deletions src/vs/editor/common/model/textModelTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { TextModel } from 'vs/editor/common/model/textModel';
import { Disposable } from 'vs/base/common/lifecycle';
import { StopWatch } from 'vs/base/common/stopwatch';
import { MultilineTokensBuilder, countEOL } from 'vs/editor/common/model/tokensStore';
import { runWhenIdle, IdleDeadline } from 'vs/base/common/async';
import { setImmediate } from 'vs/base/common/platform';

const enum Constants {
CHEAP_TOKENIZATION_LENGTH_LIMIT = 2048
Expand Down Expand Up @@ -262,19 +262,19 @@ export class TextModelTokenization extends Disposable {
}

this._isScheduled = true;
runWhenIdle((deadline) => {
setImmediate(() => {
this._isScheduled = false;

if (this._isDisposed) {
// disposed in the meantime
return;
}

this._revalidateTokensNow(deadline);
this._revalidateTokensNow();
});
}

private _revalidateTokensNow(deadline: IdleDeadline): void {
private _revalidateTokensNow(): void {
const textModelLastLineNumber = this._textModel.getLineCount();

const MAX_ALLOWED_TIME = 1;
Expand All @@ -293,7 +293,7 @@ export class TextModelTokenization extends Disposable {
if (tokenizedLineNumber >= textModelLastLineNumber) {
break;
}
} while (this._hasLinesToTokenize() && deadline.timeRemaining() > 0);
} while (this._hasLinesToTokenize());

this._beginBackgroundTokenization();
this._textModel.setTokens(builder.tokens, !this._hasLinesToTokenize());
Expand Down
4 changes: 4 additions & 0 deletions src/vs/editor/common/modes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,10 @@ export interface CompletionItem {
* A command that should be run upon acceptance of this item.
*/
command?: Command;
/**
* Custom icon to be used (instead of those ones that depend on the completionItem kind)
*/
customIcon?: HTMLElement;

/**
* @internal
Expand Down
10 changes: 9 additions & 1 deletion src/vs/editor/contrib/suggest/suggestWidgetRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,16 @@ export class ItemRenderer implements IListRenderer<CompletionItem, ISuggestionTe
matches: createMatches(element.score)
};

if (data.iconContainer.firstChild) {
data.iconContainer.removeChild(data.iconContainer.firstChild);
}

let color: string[] = [];
if (completion.kind === CompletionItemKind.Color && _completionItemColor.extract(element, color)) {
if (completion.customIcon) {
data.icon.className = 'icon hide';
data.iconContainer.className = 'suggest-icon custom-icon';
append(data.iconContainer, completion.customIcon);
} else if (completion.kind === CompletionItemKind.Color && _completionItemColor.extract(element, color)) {
// special logic for 'color' completion items
data.icon.className = 'icon customcolor';
data.iconContainer.className = 'icon hide';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1035,8 +1035,7 @@ export async function resolveMarketplaceHeaders(version: string, productService:
} | undefined): Promise<{ [key: string]: string; }> {
const headers: IHeaders = {
'X-Market-Client-Id': `VSCode ${version}`,
'X-Market-Client-Version': version,
'User-Agent': `VSCode (${productService.nameShort})`,
'User-Agent': `VSCode ${version}`
};
const uuid = await getServiceMachineId(environmentService, fileService, storageService);
if (supportsTelemetry(productService, environmentService) && getTelemetryLevel(configurationService) === TelemetryLevel.USAGE) {
Expand Down
6 changes: 3 additions & 3 deletions src/vs/platform/log/common/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { isWindows } from 'vs/base/common/platform';
import { URI } from 'vs/base/common/uri';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { createDecorator as createServiceDecorator } from 'vs/platform/instantiation/common/instantiation';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';

export const ILogService = createServiceDecorator<ILogService>('logService');
export const ILoggerService = createServiceDecorator<ILoggerService>('loggerService');
export const ILogService = createDecorator<ILogService>('logService');
export const ILoggerService = createDecorator<ILoggerService>('loggerService');

function now(): string {
return new Date().toISOString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,8 @@ export abstract class BaseCellViewModel extends Disposable {
return this._focusMode;
}
set focusMode(newMode: CellFocusMode) {
if (this._focusMode !== newMode) {
this._focusMode = newMode;
this._onDidChangeState.fire({ focusModeChanged: true });
}
this._focusMode = newMode;
this._onDidChangeState.fire({ focusModeChanged: true });
}

protected _textEditor?: ICodeEditor;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/webview/browser/webviewElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace WebviewState {
export class WebviewElement extends Disposable implements IWebview, WebviewFindDelegate {

public readonly id: string;
private readonly iframeId: string;
protected readonly iframeId: string;

protected get platform(): string { return 'browser'; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class ElectronWebviewElement extends WebviewElement {
}

protected override get webviewContentEndpoint(): string {
return `${Schemas.vscodeWebview}://${this.id}`;
return `${Schemas.vscodeWebview}://${this.iframeId}`;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
if (settingId !== this.currentColorTheme.settingsId) {
await this.internalSetColorTheme(theme.id, undefined);
} else if (theme !== this.currentColorTheme) {
await theme.ensureLoaded(this.extensionResourceLoaderService);
theme.setCustomizations(this.settings);
await this.applyTheme(theme, undefined, true);
}
Expand Down Expand Up @@ -656,6 +657,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
if (settingId !== this.currentFileIconTheme.settingsId) {
await this.internalSetFileIconTheme(theme.id, undefined);
} else if (theme !== this.currentFileIconTheme) {
await theme.ensureLoaded(this.extensionResourceLoaderService);
this.applyAndSetFileIconTheme(theme, true);
}
return true;
Expand Down Expand Up @@ -761,6 +763,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
if (settingId !== this.currentProductIconTheme.settingsId) {
await this.internalSetProductIconTheme(theme.id, undefined);
} else if (theme !== this.currentProductIconTheme) {
await theme.ensureLoaded(this.extensionResourceLoaderService, this.logService);
this.applyAndSetProductIconTheme(theme, true);
}
return true;
Expand Down
Loading