Skip to content

Commit

Permalink
Fix editor dark theme (#4719)
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeguerin authored Oct 14, 2024
1 parent 267a4f9 commit da9a31f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .chronus/changes/fix-editor-dark-theme-2024-9-14-8-3-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@typespec/playground"
---

Fix dark theme not applying
4 changes: 0 additions & 4 deletions packages/playground/src/react/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ export const Editor: FunctionComponent<EditorProps> = ({ model, options, actions
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

useEffect(() => {
editor.setTheme(options.theme ?? "typespec");
}, [options.theme]);

useEffect(() => {
const disposables: IDisposable[] = [];
for (const command of actions ?? []) {
Expand Down
4 changes: 4 additions & 0 deletions packages/playground/src/react/playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ export const Playground: FunctionComponent<PlaygroundProps> = (props) => {
const { host, onSave } = props;
const editorRef = useRef<editor.IStandaloneCodeEditor | undefined>(undefined);

useEffect(() => {
editor.setTheme(props.editorOptions?.theme ?? "typespec");
}, [props.editorOptions?.theme]);

const [selectedEmitter, onSelectedEmitterChange] = useControllableValue(
props.emitter,
props.defaultEmitter,
Expand Down
1 change: 0 additions & 1 deletion packages/playground/src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ export async function registerMonacoLanguage(host: BrowserHost) {
{ token: "function", foreground: "#E06C75" },
],
});
monaco.editor.setTheme("typespec");

monaco.languages.registerDocumentSemanticTokensProvider("typespec", {
getLegend() {
Expand Down

0 comments on commit da9a31f

Please sign in to comment.