From 1faf7992e0774e74ff9028ed1955bd3b417848f0 Mon Sep 17 00:00:00 2001 From: Aman Agarwal Date: Tue, 27 Feb 2018 18:58:53 -0800 Subject: [PATCH 01/15] Nuclide Vsp Debugger: Run To Location Summary: Add Backend agnostic Run To Location / Continue To Location support for the new Vsp debugger Reviewed By: mostafaeweda Differential Revision: D7048042 fbshipit-source-id: 33caeea1722ddb733bd1d8a265c3406c9fa1b17d --- flow-libs/vscode-debugprotocol.js.flow | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/flow-libs/vscode-debugprotocol.js.flow b/flow-libs/vscode-debugprotocol.js.flow index c70bb530..8ecae116 100644 --- a/flow-libs/vscode-debugprotocol.js.flow +++ b/flow-libs/vscode-debugprotocol.js.flow @@ -1075,6 +1075,10 @@ declare module 'vscode-debugprotocol' { supportsExceptionInfoRequest?: boolean, /** The debug adapter supports the 'terminateDebuggee' attribute on the 'disconnect' request. */ supportTerminateDebuggee?: boolean, + /** The debug adapter supports custom `continueToLocation` logic. + * This is not part of the standard Visual Studio Code debug protocol. + */ + supportsContinueToLocation?: boolean, }; /** An ExceptionBreakpointsFilter is shown in the UI as an option for configuring how exceptions are dealt with. */ From fe8b77d5564c2d47cf06039b6fcf442d0b311d79 Mon Sep 17 00:00:00 2001 From: Evan Krause Date: Wed, 28 Feb 2018 10:56:13 -0800 Subject: [PATCH 02/15] Use Process.sleep Summary: Lots of places were using it inline as `await new Promise(res => setTimeout(res, DELAY));`, this is a bit cleaner and easier to read. Reviewed By: mostafaeweda Differential Revision: D7090768 fbshipit-source-id: e40150873e4d5a0537159d5087408d0f84d29e0e --- modules/nuclide-commons-ui/spec/AtomInput-spec.js | 3 ++- modules/nuclide-commons-ui/spec/AtomTextEditor-spec.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/nuclide-commons-ui/spec/AtomInput-spec.js b/modules/nuclide-commons-ui/spec/AtomInput-spec.js index 03abd029..741fc0c2 100644 --- a/modules/nuclide-commons-ui/spec/AtomInput-spec.js +++ b/modules/nuclide-commons-ui/spec/AtomInput-spec.js @@ -10,6 +10,7 @@ * @format */ +import {sleep} from 'nuclide-commons/promise'; import {AtomInput} from '../AtomInput'; import * as React from 'react'; import ReactDOM from 'react-dom'; @@ -109,7 +110,7 @@ describe('AtomInput', () => { ReactDOM.unmountComponentAtNode(hostEl); // Cleanup occurs during the next tick. - await new Promise(resolve => setTimeout(resolve, 0)); + await sleep(0); expect(element.component).toBe(null); }); }); diff --git a/modules/nuclide-commons-ui/spec/AtomTextEditor-spec.js b/modules/nuclide-commons-ui/spec/AtomTextEditor-spec.js index 142de69f..b82b6639 100644 --- a/modules/nuclide-commons-ui/spec/AtomTextEditor-spec.js +++ b/modules/nuclide-commons-ui/spec/AtomTextEditor-spec.js @@ -10,6 +10,7 @@ * @format */ +import {sleep} from 'nuclide-commons/promise'; import {AtomTextEditor} from '../AtomTextEditor'; import * as React from 'react'; import ReactDOM from 'react-dom'; @@ -181,7 +182,7 @@ describe('nuclide-ui-atom-text-editor', () => { ReactDOM.unmountComponentAtNode(hostEl); // Cleanup occurs during the next tick. - await new Promise(resolve => setTimeout(resolve, 0)); + await sleep(0); expect(element.component).toBe(null); }); }); From 62f8422334eaf8418848a0e67f21e91db751b9db Mon Sep 17 00:00:00 2001 From: Will Binns-Smith Date: Wed, 28 Feb 2018 11:24:55 -0800 Subject: [PATCH 03/15] Backport editor custom properties Summary: This backports the functionality introduced in https://github.com/atom/atom/pull/16731 -- which tracks editor size, line height, and font family in the form of custom properties on `atom-workspace`. Reviewed By: matthewwithanm Differential Revision: D7065673 fbshipit-source-id: 68ef63048a106e1202889ded7909e402719de0af --- .../lib/backports/installTextEditorStyles.js | 65 +++++++++++++++++++ .../pkg/atom-ide-global/lib/main.js | 29 +++++++++ 2 files changed, 94 insertions(+) create mode 100644 modules/atom-ide-ui/pkg/atom-ide-global/lib/backports/installTextEditorStyles.js create mode 100644 modules/atom-ide-ui/pkg/atom-ide-global/lib/main.js diff --git a/modules/atom-ide-ui/pkg/atom-ide-global/lib/backports/installTextEditorStyles.js b/modules/atom-ide-ui/pkg/atom-ide-global/lib/backports/installTextEditorStyles.js new file mode 100644 index 00000000..d1dbc4b8 --- /dev/null +++ b/modules/atom-ide-ui/pkg/atom-ide-global/lib/backports/installTextEditorStyles.js @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow + * @format + */ + +import UniversalDisposable from 'nuclide-commons/UniversalDisposable'; +import {observableFromSubscribeFunction} from 'nuclide-commons/event'; +import {Observable} from 'rxjs'; +import invariant from 'assert'; +import semver from 'semver'; + +export default function installTextEditorStyles(): IDisposable { + if (semver.gte(atom.appVersion, '1.26.0')) { + // this behavior is part of 1.26 and greater + return new UniversalDisposable(); + } + + let styleSheetDisposable = new UniversalDisposable(); + + return new UniversalDisposable( + () => styleSheetDisposable.dispose(), + Observable.combineLatest( + observableFromSubscribeFunction( + atom.config.observe.bind(atom.config, 'editor.fontSize'), + ), + observableFromSubscribeFunction( + atom.config.observe.bind(atom.config, 'editor.fontFamily'), + ), + observableFromSubscribeFunction( + atom.config.observe.bind(atom.config, 'editor.lineHeight'), + ), + ).subscribe(([fontSize, fontFamily, lineHeight]) => { + invariant( + typeof fontSize === 'number' && + typeof fontFamily === 'string' && + typeof lineHeight === 'number', + ); + + const styleSheetSource = ` + atom-workspace { + --editor-font-size: ${fontSize}px; + --editor-font-family: ${fontFamily}; + --editor-line-height: ${lineHeight}; + } + `; + + styleSheetDisposable.dispose(); + // $FlowIgnore + styleSheetDisposable = atom.workspace.styleManager.addStyleSheet( + styleSheetSource, + { + sourcePath: 'text-editor-styles-backport', + priority: -1, + }, + ); + }), + ); +} diff --git a/modules/atom-ide-ui/pkg/atom-ide-global/lib/main.js b/modules/atom-ide-ui/pkg/atom-ide-global/lib/main.js new file mode 100644 index 00000000..148ce23e --- /dev/null +++ b/modules/atom-ide-ui/pkg/atom-ide-global/lib/main.js @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow + * @format + */ + +import createPackage from 'nuclide-commons-atom/createPackage'; +import UniversalDisposable from 'nuclide-commons/UniversalDisposable'; +import installTextEditorStyles from './backports/installTextEditorStyles'; + +class Activation { + _disposables: UniversalDisposable; + + activate() { + this._disposables = new UniversalDisposable(installTextEditorStyles()); + } + + dispose() { + this._disposables.dispose(); + } +} + +createPackage(module.exports, Activation); From 72486510235f243bd4106497a435101cafb07b1c Mon Sep 17 00:00:00 2001 From: Will Binns-Smith Date: Wed, 28 Feb 2018 11:24:57 -0800 Subject: [PATCH 04/15] Use custom properties to track editor styles Summary: This uses the prior diff's backport to style Outline the same as the editor. This replaces the hacky stylesheet injection inside Outline (with a slightly more proper stylsheet injection at a higher level). Reviewed By: matthewwithanm Differential Revision: D7065674 fbshipit-source-id: f858d6bd7c3511cd383cb7f5c5a1cfba183f046e --- .../atom-ide-outline-view/lib/OutlineView.js | 36 ------------------- .../styles/outline-view.less | 5 +-- 2 files changed, 3 insertions(+), 38 deletions(-) diff --git a/modules/atom-ide-ui/pkg/atom-ide-outline-view/lib/OutlineView.js b/modules/atom-ide-ui/pkg/atom-ide-outline-view/lib/OutlineView.js index 8c5d554e..25fd0729 100644 --- a/modules/atom-ide-ui/pkg/atom-ide-outline-view/lib/OutlineView.js +++ b/modules/atom-ide-ui/pkg/atom-ide-outline-view/lib/OutlineView.js @@ -65,40 +65,15 @@ const TOKEN_KIND_TO_CLASS_NAME_MAP = { }; export class OutlineView extends React.PureComponent { - subscription: ?UniversalDisposable; _outlineViewRef: ?React.ElementRef; - state = { - fontFamily: (atom.config.get('editor.fontFamily'): any), - fontSize: (atom.config.get('editor.fontSize'): any), - lineHeight: (atom.config.get('editor.lineHeight'): any), - }; componentDidMount(): void { - invariant(this.subscription == null); - this.subscription = new UniversalDisposable( - atom.config.observe('editor.fontSize', (size: mixed) => { - this.setState({fontSize: (size: any)}); - }), - atom.config.observe('editor.fontFamily', (font: mixed) => { - this.setState({fontFamily: (font: any)}); - }), - atom.config.observe('editor.lineHeight', (size: mixed) => { - this.setState({lineHeight: (size: any)}); - }), - ); - // Ensure that focus() gets called during the initial mount. if (this.props.visible) { this.focus(); } } - componentWillUnmount(): void { - invariant(this.subscription != null); - this.subscription.unsubscribe(); - this.subscription = null; - } - componentDidUpdate(prevProps: Props) { if (this.props.visible && !prevProps.visible) { this.focus(); @@ -120,17 +95,6 @@ export class OutlineView extends React.PureComponent { render(): React.Node { return (
-