Skip to content

Commit

Permalink
Give tools in the CE options a type (#4471)
Browse files Browse the repository at this point in the history
* Fix type of tool id

Observed through the debugger it seems the tool id is a `string`, which leads to all sorts of downstream complaints comparing strings to ints when converting tools.js to ts (see #4166)

* Add tools to CE Options

* Fixings
  • Loading branch information
mattgodbolt committed Dec 20, 2022
1 parent 9f29543 commit 4ec6a41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions static/options.interfaces.ts
Expand Up @@ -24,6 +24,7 @@

import {Language, LanguageKey} from '../types/languages.interfaces';
import {CompilerInfo} from '../types/compiler.interfaces';
import {Tool} from '../types/tool.interfaces';

export type LibraryVersion = {
alias: string[];
Expand Down Expand Up @@ -60,4 +61,5 @@ export type Options = {
release?: string;
sentryEnvironment?: string;
compileOptions: Record<LanguageKey, string>;
tools: Record<LanguageKey, Record<string, Tool>>;
};
2 changes: 1 addition & 1 deletion static/panes/compiler.ts
Expand Up @@ -2388,7 +2388,7 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
const createToolView: () => ComponentConfig<ToolViewState> = () => {
let args = '';
let monacoStdin = false;
const langTools = (options.tools as any)[this.currentLangId ?? ''];
const langTools = options.tools[this.currentLangId ?? ''];
if (langTools && langTools[toolId] && langTools[toolId].tool) {
if (langTools[toolId].tool.args !== undefined) {
args = langTools[toolId].tool.args;
Expand Down

0 comments on commit 4ec6a41

Please sign in to comment.