diff --git a/news/1 Enhancements/6381.md b/news/1 Enhancements/6381.md new file mode 100644 index 000000000000..9d542602e77f --- /dev/null +++ b/news/1 Enhancements/6381.md @@ -0,0 +1 @@ +Make the input box more visible to new users. diff --git a/package-lock.json b/package-lock.json index 77338a7ee23c..d0d0db2f8745 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14014,7 +14014,7 @@ }, "convert-source-map": { "version": "1.6.0", - "resolved": "", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", "dev": true, "requires": { @@ -14023,7 +14023,7 @@ }, "execa": { "version": "1.0.0", - "resolved": "", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", "dev": true, "requires": { @@ -14049,7 +14049,7 @@ }, "find-up": { "version": "3.0.0", - "resolved": "", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "dev": true, "requires": { @@ -14064,7 +14064,7 @@ }, "get-stream": { "version": "4.1.0", - "resolved": "", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "dev": true, "requires": { @@ -14087,7 +14087,7 @@ }, "locate-path": { "version": "3.0.0", - "resolved": "", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { @@ -14107,7 +14107,7 @@ }, "os-locale": { "version": "3.1.0", - "resolved": "", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", "dev": true, "requires": { @@ -14118,7 +14118,7 @@ }, "path-exists": { "version": "3.0.0", - "resolved": "", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true }, @@ -14130,7 +14130,7 @@ }, "pkg-dir": { "version": "3.0.0", - "resolved": "", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", "dev": true, "requires": { @@ -14139,7 +14139,7 @@ }, "pump": { "version": "3.0.0", - "resolved": "", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "dev": true, "requires": { @@ -14155,13 +14155,13 @@ }, "resolve-from": { "version": "4.0.0", - "resolved": "", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, "rimraf": { "version": "2.6.3", - "resolved": "", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "dev": true, "requires": { diff --git a/package.json b/package.json index 0779c1926d88..efa12d36d128 100644 --- a/package.json +++ b/package.json @@ -1412,6 +1412,12 @@ "description": "Limit the amount of text in Python Interactive cell text output to this value. 0 to allow any amount of characters.", "scope": "resource" }, + "python.dataScience.colorizeInputBox": { + "type": "boolean", + "default": true, + "description": "Whether or not to use the theme's peek color as the background for the input box.", + "scope": "resource" + }, "python.dataScience.stopOnError": { "type": "boolean", "default": true, diff --git a/package.nls.json b/package.nls.json index c01172335474..badb4e2bd7f5 100644 --- a/package.nls.json +++ b/package.nls.json @@ -148,7 +148,7 @@ "DataScience.pythonRestartHeader": "Restarted kernel:", "DataScience.pythonNewHeader": "Started new kernel:", "DataScience.executingCodeFailure": "Executing code failed : {0}", - "DataScience.inputWatermark": "Shift-enter to run", + "DataScience.inputWatermark": "Type code here and press shift-enter to run", "DataScience.deleteButtonTooltip": "Remove cell", "DataScience.gotoCodeButtonTooltip": "Go to code", "DataScience.copyBackToSourceButtonTooltip": "Paste code into file", diff --git a/src/client/common/types.ts b/src/client/common/types.ts index a4b1083d4100..e7e035185854 100644 --- a/src/client/common/types.ts +++ b/src/client/common/types.ts @@ -330,6 +330,7 @@ export interface IDataScienceSettings { magicCommandsAsComments?: boolean; stopOnError?: boolean; remoteDebuggerPort?: number; + colorizeInputBox?: boolean; } export const IConfigurationService = Symbol('IConfigurationService'); diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index a3a2c01fb426..04c346e5b853 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -181,7 +181,7 @@ export namespace DataScience { export const pythonInterruptFailedHeader = localize('DataScience.pythonInterruptFailedHeader', 'Keyboard interrupt crashed the kernel. Kernel restarted.'); export const sysInfoURILabel = localize('DataScience.sysInfoURILabel', 'Jupyter Server URI: '); export const executingCodeFailure = localize('DataScience.executingCodeFailure', 'Executing code failed : {0}'); - export const inputWatermark = localize('DataScience.inputWatermark', 'Shift-enter to run'); + export const inputWatermark = localize('DataScience.inputWatermark', 'Type code here and press shift-enter to run'); export const liveShareConnectFailure = localize('DataScience.liveShareConnectFailure', 'Cannot connect to host jupyter session. URI not found.'); export const liveShareCannotSpawnNotebooks = localize('DataScience.liveShareCannotSpawnNotebooks', 'Spawning jupyter notebooks is not supported over a live share connection'); export const liveShareCannotImportNotebooks = localize('DataScience.liveShareCannotImportNotebooks', 'Importing notebooks is not currently supported over a live share connection'); diff --git a/src/datascience-ui/history-react/MainPanel.tsx b/src/datascience-ui/history-react/MainPanel.tsx index f8c326bfb8be..4bc9b002cba9 100644 --- a/src/datascience-ui/history-react/MainPanel.tsx +++ b/src/datascience-ui/history-react/MainPanel.tsx @@ -308,9 +308,10 @@ export class MainPanel extends React.Component const maxOutputSize = getSettings().maxOutputSize; const maxTextSize = maxOutputSize && maxOutputSize < 10000 && maxOutputSize > 0 ? maxOutputSize : undefined; const executionCount = this.getInputExecutionCount(); + const editPanelClass = getSettings().colorizeInputBox ? 'edit-panel-colorized' : 'edit-panel'; return ( -
+
submitNewCode={this.submitInput} baseTheme={baseTheme} codeTheme={this.props.codeTheme} - showWatermark={!this.state.submittedText} + showWatermark={true} ref={this.saveEditCellRef} gotoCode={noop} copyCode={noop} diff --git a/src/datascience-ui/history-react/cell.tsx b/src/datascience-ui/history-react/cell.tsx index 87df65524bdc..659f3f456ebd 100644 --- a/src/datascience-ui/history-react/cell.tsx +++ b/src/datascience-ui/history-react/cell.tsx @@ -269,7 +269,7 @@ export class Cell extends React.Component { private renderInputs = () => { if (this.showInputs()) { - const backgroundColor = this.props.cellVM.cell.type === 'preview' ? + const backgroundColor = this.props.cellVM.cell.type === 'preview' || (getSettings().colorizeInputBox && this.props.cellVM.editable) ? 'var(--override-peek-background, var(--vscode-peekViewEditor-background))' : undefined; diff --git a/src/datascience-ui/history-react/code.tsx b/src/datascience-ui/history-react/code.tsx index 8cb117a06ef1..432ae09e8310 100644 --- a/src/datascience-ui/history-react/code.tsx +++ b/src/datascience-ui/history-react/code.tsx @@ -122,7 +122,7 @@ export class Code extends React.Component { } private getWatermarkString = () : string => { - return getLocString('DataScience.inputWatermark', 'Shift-enter to run'); + return getLocString('DataScience.inputWatermark', 'Type code here and press shift-enter to run'); } private editorDidMount = (editor: monacoEditor.editor.IStandaloneCodeEditor) => { @@ -147,8 +147,8 @@ export class Code extends React.Component { if (this.state.model) { this.props.onChange(e.changes, this.state.model.id); } - if (!this.props.readOnly) { - this.setState({allowWatermark: false}); + if (!this.props.readOnly && this.state.model) { + this.setState({allowWatermark: this.state.model.getValueLength() === 0}); } } diff --git a/src/datascience-ui/history-react/mainPanel.css b/src/datascience-ui/history-react/mainPanel.css index 6657611f76dc..b2f6fe28fb3a 100644 --- a/src/datascience-ui/history-react/mainPanel.css +++ b/src/datascience-ui/history-react/mainPanel.css @@ -50,14 +50,24 @@ body, html { } .invisible { - visibility: hidden; + visibility: hidden; } .edit-panel { min-height:50px; padding: 10px 0px 10px 0px; width: 100%; - border-top-color: var(--override-widget-background, var(--vscode-editorGroupHeader-tabsBackground)); + border-top-color: var(--override-badge-background, var(--vscode-badge-background)); border-top-style: solid; - border-top-width: 1px; -} \ No newline at end of file + border-top-width: 2px; +} + +.edit-panel-colorized { + min-height:50px; + padding: 10px 0px 10px 0px; + width: 100%; + border-top-color: var(--override-badge-background, var(--vscode-badge-background)); + border-top-style: solid; + border-top-width: 2px; + background-color: var(--override-peek-background, var(--vscode-peekViewEditor-background)); +} diff --git a/src/datascience-ui/react-common/monacoEditor.tsx b/src/datascience-ui/react-common/monacoEditor.tsx index 22917cd6f431..f21e91e1defc 100644 --- a/src/datascience-ui/react-common/monacoEditor.tsx +++ b/src/datascience-ui/react-common/monacoEditor.tsx @@ -197,7 +197,8 @@ export class MonacoEditor extends React.Component { - if (this.state.editor && this.containerRef.current && this.props.forceBackground) { + if (this.state.editor && this.containerRef.current) { const nodes = this.containerRef.current.getElementsByClassName('monaco-editor-background'); if (nodes && nodes.length > 0) { const backgroundNode = nodes[0] as HTMLDivElement; if (backgroundNode && backgroundNode.style) { - backgroundNode.style.backgroundColor = this.props.forceBackground; + backgroundNode.style.backgroundColor = this.props.forceBackground ? this.props.forceBackground : 'transparent'; } } }