-
Notifications
You must be signed in to change notification settings - Fork 33
feat: Add SageMaker UI Dark Theme extension #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| .vscode/** | ||
| .vscode-test/** | ||
| out/test/** | ||
| out/** | ||
| test/** | ||
| src/** | ||
| tsconfig.json | ||
| out/test/** | ||
| out/** | ||
| cgmanifest.json | ||
| yarn.lock | ||
| preview-src/** |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # SageMaker UI Dark Theme |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright Amazon.com Inc. or its affiliates. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| //@ts-check | ||
|
|
||
| 'use strict'; | ||
|
|
||
| const withBrowserDefaults = require('../shared.webpack.config').browser; | ||
|
|
||
| module.exports = withBrowserDefaults({ | ||
| context: __dirname, | ||
| entry: { | ||
| extension: './src/extension.ts' | ||
| }, | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright Amazon.com Inc. or its affiliates. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| //@ts-check | ||
|
|
||
| 'use strict'; | ||
|
|
||
| const withDefaults = require('../shared.webpack.config'); | ||
|
|
||
| module.exports = withDefaults({ | ||
| context: __dirname, | ||
| resolve: { | ||
| mainFields: ['module', 'main'] | ||
| }, | ||
| entry: { | ||
| extension: './src/extension.ts', | ||
| } | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| { | ||
| "name": "sagemaker-ui-dark-theme", | ||
| "displayName": "SageMaker UI Dark Theme", | ||
| "description": "SageMaker UI Dark Theme", | ||
| "extensionKind": [ | ||
| "workspace" | ||
| ], | ||
| "version": "1.0.0", | ||
| "publisher": "sagemaker", | ||
| "license": "MIT", | ||
| "engines": { | ||
| "vscode": "^1.70.0" | ||
| }, | ||
| "main": "./out/extension", | ||
| "categories": [ | ||
| "Other" | ||
| ], | ||
| "activationEvents": [ | ||
| "onStartupFinished" | ||
| ], | ||
| "capabilities": { | ||
| "virtualWorkspaces": true, | ||
| "untrustedWorkspaces": { | ||
| "supported": true | ||
| } | ||
| }, | ||
| "contributes": { | ||
| "configuration": { | ||
| "type": "object", | ||
| "title": "SageMaker UI Dark Theme", | ||
| "properties": {} | ||
| }, | ||
| "commands": [ | ||
| ] | ||
| }, | ||
| "scripts": { | ||
| "compile": "gulp compile-extension:sagemaker-ui-dark-theme", | ||
| "watch": "npm run build-preview && gulp watch-extension:sagemaker-ui-dark-theme", | ||
| "vscode:prepublish": "npm run build-ext", | ||
| "build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:sagemaker-ui-dark-theme ./tsconfig.json" | ||
| }, | ||
| "dependencies": { | ||
| }, | ||
| "repository": { | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import * as vscode from 'vscode'; | ||
|
|
||
| const SERVICE_NAME_ENV_KEY = 'SERVICE_NAME'; | ||
| const SERVICE_NAME_ENV_VALUE = 'SageMakerUnifiedStudio'; | ||
| const DEFAULT_THEME = 'Default Dark Modern'; | ||
|
|
||
| let outputChannel: vscode.OutputChannel; | ||
|
|
||
| export function activate() { | ||
| // Check if in SageMaker Unified Studio | ||
| const envValue = process.env[SERVICE_NAME_ENV_KEY]; | ||
| if (!envValue || envValue !== SERVICE_NAME_ENV_VALUE) { | ||
| return; | ||
| } | ||
|
|
||
| const config = vscode.workspace.getConfiguration(); | ||
| const themeConfig = config.inspect('workbench.colorTheme'); | ||
| outputChannel = vscode.window.createOutputChannel('SageMaker UI Dark Theme'); | ||
|
|
||
| outputChannel.appendLine(`Current theme configuration: ${JSON.stringify(themeConfig, null, 2)}`); | ||
|
|
||
| // Check if theme is only set at default level | ||
| if (themeConfig?.globalValue === undefined && | ||
| themeConfig?.workspaceValue === undefined && | ||
| themeConfig?.workspaceFolderValue === undefined) { | ||
|
|
||
| outputChannel.appendLine('Theme only set at default level, applying theme update'); | ||
|
|
||
| // Update the configuration | ||
| Promise.resolve( | ||
| config.update('workbench.colorTheme', DEFAULT_THEME, vscode.ConfigurationTarget.Global) | ||
| .then(() => { | ||
| outputChannel.appendLine(`Theme configuration updated to ${DEFAULT_THEME}`); | ||
| // Reload to apply theme | ||
| return vscode.commands.executeCommand('workbench.action.reloadWindow'); | ||
| }) | ||
| .then(() => outputChannel.appendLine('Theme applied successfully')) | ||
| ) | ||
| .catch((error) => { | ||
| outputChannel.appendLine(`Failed to apply theme: ${error}`); | ||
| }); | ||
| } else { | ||
| outputChannel.appendLine('Theme already configured in user or workspace settings, not overriding'); | ||
| } | ||
| } | ||
|
|
||
| export function deactivate() { | ||
| if (outputChannel) { | ||
| outputChannel.dispose(); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "extends": "../tsconfig.base.json", | ||
| "compilerOptions": { | ||
| "outDir": "./out" | ||
| }, | ||
| "include": [ | ||
| "src/**/*", | ||
| "../../src/vscode-dts/vscode.d.ts" | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
| # yarn lockfile v1 | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ | |
| "watch-client": "node --max-old-space-size=4095 ./node_modules/gulp/bin/gulp.js watch-client", | ||
| "watch-clientd": "deemon yarn watch-client", | ||
| "kill-watch-clientd": "deemon --kill yarn watch-client", | ||
| "watch-extensions": "node --max-old-space-size=4095 ./node_modules/gulp/bin/gulp.js watch-extensions watch-extension-media", | ||
| "watch-extensions": "node --max-old-space-size=8191 ./node_modules/gulp/bin/gulp.js watch-extensions watch-extension-media", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we increasing this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running This is likely due to the number of file watchers present already being large, with this new extension pushing past this limit, changing the garbage collection behavior. Tested this in both local and on an EC2 instance. Increasing this to 8191 fixes. |
||
| "watch-extensionsd": "deemon yarn watch-extensions", | ||
| "kill-watch-extensionsd": "deemon --kill yarn watch-extensions", | ||
| "precommit": "node build/hygiene.js", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool! this should be the standard for all extension logging