diff --git a/src/vs/base/common/flags.ts b/src/vs/base/common/flags.ts index d789f997053..609b60c585e 100644 --- a/src/vs/base/common/flags.ts +++ b/src/vs/base/common/flags.ts @@ -2,19 +2,18 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + 'use strict'; -import { globals } from 'vs/base/common/platform'; - -export const enableSendASmile = environment('enableSendASmile'); +import {globals} from 'vs/base/common/platform'; // Telemetry endpoint (used in the standalone editor) for hosts that want to collect editor telemetry -export const standaloneEditorTelemetryEndpoint:string = environment('telemetryEndpoint', null); +export const standaloneEditorTelemetryEndpoint: string = environment('telemetryEndpoint', null); // Option for hosts to overwrite the worker script url (used in the standalone editor) -export const getCrossOriginWorkerScriptUrl:(workerId:string, label:string)=>string = environment('getWorkerUrl', null); +export const getCrossOriginWorkerScriptUrl: (workerId: string, label: string) => string = environment('getWorkerUrl', null); -function environment(name:string, fallback:any = false):any { +function environment(name: string, fallback: any = false): any { if (globals.MonacoEnvironment && globals.MonacoEnvironment.hasOwnProperty(name)) { return globals.MonacoEnvironment[name]; } @@ -22,6 +21,6 @@ function environment(name:string, fallback:any = false):any { return fallback; } -export function workersCount(defaultCount:number): number { +export function workersCount(defaultCount: number): number { return environment('workersCount', defaultCount); } diff --git a/src/vs/workbench/electron-browser/index.html b/src/vs/workbench/electron-browser/index.html index 7b6eb732049..797fcdf3599 100644 --- a/src/vs/workbench/electron-browser/index.html +++ b/src/vs/workbench/electron-browser/index.html @@ -172,10 +172,7 @@ }); } - window.MonacoEnvironment = { - 'enableSendASmile' : !!configuration.sendASmile - }; - + window.MonacoEnvironment = {}; var timers = window.MonacoEnvironment.timers = { start: new Date() }; diff --git a/src/vs/workbench/parts/feedback/electron-browser/feedback.contribution.ts b/src/vs/workbench/parts/feedback/electron-browser/feedback.contribution.ts index dd76c8e77c2..4591ff54a9d 100644 --- a/src/vs/workbench/parts/feedback/electron-browser/feedback.contribution.ts +++ b/src/vs/workbench/parts/feedback/electron-browser/feedback.contribution.ts @@ -5,15 +5,12 @@ 'use strict'; import {Registry} from 'vs/platform/platform'; -import * as Flags from 'vs/base/common/flags'; import {StatusbarAlignment, IStatusbarRegistry, Extensions, StatusbarItemDescriptor} from 'vs/workbench/browser/parts/statusbar/statusbar'; import {FeedbackStatusbarItem} from 'vs/workbench/parts/feedback/electron-browser/feedbackStatusbarItem'; // Register Statusbar item -if (Flags.enableSendASmile) { - (Registry.as(Extensions.Statusbar)).registerStatusbarItem(new StatusbarItemDescriptor( - FeedbackStatusbarItem, - StatusbarAlignment.RIGHT, - -100 /* Low Priority */ - )); -} \ No newline at end of file +(Registry.as(Extensions.Statusbar)).registerStatusbarItem(new StatusbarItemDescriptor( + FeedbackStatusbarItem, + StatusbarAlignment.RIGHT, + -100 /* Low Priority */ +)); \ No newline at end of file diff --git a/src/vs/workbench/parts/feedback/electron-browser/feedbackStatusbarItem.ts b/src/vs/workbench/parts/feedback/electron-browser/feedbackStatusbarItem.ts index 910fc4bab99..31cb5e27ea7 100644 --- a/src/vs/workbench/parts/feedback/electron-browser/feedbackStatusbarItem.ts +++ b/src/vs/workbench/parts/feedback/electron-browser/feedbackStatusbarItem.ts @@ -10,15 +10,16 @@ import {IStatusbarItem} from 'vs/workbench/browser/parts/statusbar/statusbar'; import {FeedbackDropdown, IFeedback, IFeedbackService} from 'vs/workbench/parts/feedback/browser/feedback'; import {IContextViewService} from 'vs/platform/contextview/browser/contextView'; import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation'; +import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace'; import {shell} from 'electron'; class TwitterFeedbackService implements IFeedbackService { private static TWITTER_URL: string = 'https://twitter.com/intent/tweet'; private static VIA_NAME: string = 'code'; - private static HASHTAGS: string[] = ['HappyCoding']; + private static HASHTAGS: string[] = ['HappyCoding']; - private combineHashTagsAsString() : string { + private combineHashTagsAsString(): string { return TwitterFeedbackService.HASHTAGS.join(','); } @@ -29,9 +30,8 @@ class TwitterFeedbackService implements IFeedbackService { } public getCharacterLimit(sentiment: number): number { - let length : number = 0; - if (sentiment === 1) - { + let length: number = 0; + if (sentiment === 1) { TwitterFeedbackService.HASHTAGS.forEach(element => { length += element.length + 2; }); @@ -48,14 +48,17 @@ export class FeedbackStatusbarItem implements IStatusbarItem { constructor( @IInstantiationService private instantiationService: IInstantiationService, - @IContextViewService private contextViewService: IContextViewService + @IContextViewService private contextViewService: IContextViewService, + @IWorkspaceContextService private contextService: IWorkspaceContextService ) { } public render(element: HTMLElement): IDisposable { - return this.instantiationService.createInstance(FeedbackDropdown, element, { - contextViewProvider: this.contextViewService, - feedbackService: this.instantiationService.createInstance(TwitterFeedbackService) - }); + if (this.contextService.getConfiguration().env.sendASmile) { + return this.instantiationService.createInstance(FeedbackDropdown, element, { + contextViewProvider: this.contextViewService, + feedbackService: this.instantiationService.createInstance(TwitterFeedbackService) + }); + } } } \ No newline at end of file