diff --git a/client/package.json b/client/package.json index a795ae4..bcd9cab 100644 --- a/client/package.json +++ b/client/package.json @@ -137,11 +137,6 @@ "type": "boolean", "default": true, "description": "Auto-unindent `Qed.`, `Defined.`, and `Admitted.`. Note: requires `editor.formatOnType' to be set to `true` in settings.json" - }, - "coq.hacks.userSettingsLocation": { - "type": "string", - "default": null, - "description": "Hack: vscode does not currently indicate to extensions where user-settings should be stored. Currently, we store such settings in this extension's own directory, but these will be overriden when this extension is updated. This setting allows you to override where user-settings are stored. WARNING: this setting will eventually go away." } } }, @@ -332,11 +327,6 @@ "command": "extension.coq.ltacProf.getResults", "title": "View ltac profile", "category": "Coq" - }, - { - "command": "extension.coq.proofView.customizeProofViewStyle", - "title": "Customize proof-view styling", - "category": "Coq" } ], "keybindings": [ @@ -531,6 +521,260 @@ "language": "coq", "path": "./snippets/coq.json" } + ], + "colors": [ + { + "id": "coq.proofviewText", + "description": "Color for proofview text.", + "defaults": { + "dark": "#cccccc", + "light": "#333333", + "highContrast": "#333333" + } + }, + { + "id": "coq.proofviewMessage", + "description": "Color for proofview messages.", + "defaults": { + "dark": "#cccccc", + "light": "#333333", + "highContrast": "#333333" + } + }, + { + "id": "coq.proofviewError", + "description": "Color for proofview errors.", + "defaults": { + "dark": "#ffc0cb", + "light": "#ff0000", + "highContrast": "#ff0000" + } + }, + { + "id": "coq.hypothesisIdent", + "description": "Color for goal hypotheses identifiers.", + "defaults": { + "dark": "#20b2aa", + "light": "#006400", + "highContrast": "#006400" + } + }, + { + "id": "coq.hypothesesSeparator", + "description": "Color for hypotheses separator.", + "defaults": { + "dark": "#ffffff66", + "light": "#00000033", + "highContrast": "#00000033" + } + }, + { + "id": "coq.oddHypothesisBackground", + "description": "Background color for hypotheses with odd index.", + "defaults": { + "dark": "#0000000d", + "light": "#ffffff0d", + "highContrast": "#ffffff0d" + } + }, + { + "id": "coq.newHypothesisBackground", + "description": "Background color for new hypotheses.", + "defaults": { + "dark": "#00ff0017", + "light": "#00aa0040", + "highContrast": "#00aa0040" + } + }, + { + "id": "coq.changedHypothesisBackground", + "description": "Background color for changed hypotheses.", + "defaults": { + "dark": "#0000ff26", + "light": "#0000ff0d", + "highContrast": "#0000ff0d" + } + }, + { + "id": "coq.goalId", + "description": "Color of goal identifiers.", + "defaults": { + "dark": "#add8e6", + "light": "#00008b", + "highContrast": "#00008b" + } + }, + { + "id": "coq.addedCharacter", + "description": "Color of added characters (in diffs).", + "defaults": { + "dark": "#00fa001a", + "light": "#00fa0033", + "highContrast": "#00fa0033" + } + }, + { + "id": "coq.removedCharacter", + "description": "Color of removed characters (in diffs).", + "defaults": { + "dark": "#fa000099", + "light": "#fa000033", + "highContrast": "#fa000033" + } + }, + { + "id": "coq.mainSubgoalBackground", + "description": "Background color for main subgoal.", + "defaults": { + "dark": "#ffffff0d", + "light": "#0000000d", + "highContrast": "#0000000d" + } + }, + { + "id": "coq.subgoalBackground", + "description": "Background color for subgoals.", + "defaults": { + "dark": "#ffffff0d", + "light": "#0000000d", + "highContrast": "#0000000d" + } + }, + { + "id": "coq.subgoalSeparator", + "description": "Color of subgoal separators.", + "defaults": { + "dark": "#ffffff33", + "light": "#00000033", + "highContrast": "#00000033" + } + }, + { + "id": "coq.termNotation", + "description": "Color of term notations.", + "defaults": { + "dark": "#ff8c00", + "light": "#ff8c00", + "highContrast": "#ff8c00" + } + }, + { + "id": "coq.termKeyword", + "description": "Color of term keywords.", + "defaults": { + "dark": "#6495ed", + "light": "#6495ed", + "highContrast": "#6495ed" + } + }, + { + "id": "coq.termEvar", + "description": "Color of existential variables.", + "defaults": { + "dark": "#ff8c00", + "light": "#ff8c00", + "highContrast": "#ff8c00" + } + }, + { + "id": "coq.termPath", + "description": "Color of term paths.", + "defaults": { + "dark": "#9370d8", + "light": "#ff8c00", + "highContrast": "#ff8c00" + } + }, + { + "id": "coq.termReference", + "description": "Color of name references in terms.", + "defaults": { + "dark": "#7cfc00", + "light": "#32cd32", + "highContrast": "#32cd32" + } + }, + { + "id": "coq.termType", + "description": "Color of types in terms.", + "defaults": { + "dark": "#f08080", + "light": "#ff7f50", + "highContrast": "#ff7f50" + } + }, + { + "id": "coq.termVariable", + "description": "Color of variables in terms.", + "defaults": { + "dark": "#7fff00", + "light": "#20b2aa", + "highContrast": "#20b2aa" + } + }, + { + "id": "coq.debugMessage", + "description": "Color of debug messages.", + "defaults": { + "dark": "#9370d8", + "light": "#daa520", + "highContrast": "#daa520" + } + }, + { + "id": "coq.errorMessage", + "description": "Color of error messages.", + "defaults": { + "dark": "#ff0000", + "light": "#ff0000", + "highContrast": "#ff0000" + } + }, + { + "id": "coq.warningMessage", + "description": "Color of warning messages.", + "defaults": { + "dark": "#ffff00", + "light": "#ffff00", + "highContrast": "#ffff00" + } + }, + { + "id": "coq.moduleKeyword", + "description": "Color of module keywords.", + "defaults": { + "dark": "#6495ed", + "light": "#6495ed", + "highContrast": "#6495ed" + } + }, + { + "id": "coq.tacticKeyword", + "description": "Color of tactic keywords.", + "defaults": { + "dark": "#6495ed", + "light": "#6495ed", + "highContrast": "#6495ed" + } + }, + { + "id": "coq.tacticPrimitive", + "description": "Color of tactic primitives.", + "defaults": { + "dark": "#5f9ea0", + "light": "#5f9ea0", + "highContrast": "#5f9ea0" + } + }, + { + "id": "coq.tacticString", + "description": "Color of tactic strings.", + "defaults": { + "dark": "#ffa500", + "light": "#ffa500", + "highContrast": "#ffa500" + } + } ] }, "scripts": { diff --git a/client/src/HtmlCoqView.ts b/client/src/HtmlCoqView.ts index 5cd7d8a..cb83f7f 100644 --- a/client/src/HtmlCoqView.ts +++ b/client/src/HtmlCoqView.ts @@ -6,7 +6,6 @@ import {extensionContext} from './extension' import * as proto from './protocol' import * as path from 'path'; import * as docs from './CoqProject'; -import * as nasync from './nodejs-async'; import * as psm from './prettify-symbols-mode'; import mustache = require('mustache'); @@ -33,7 +32,6 @@ interface SettingsState { fontFamily?: string, fontSize?: string, fontWeight?: string, - cssFile?: string, prettifySymbolsMode?: boolean, } @@ -42,13 +40,6 @@ type ProofViewProtocol = GoalUpdate | SettingsUpdate; const VIEW_PATH = 'html_views'; -function proofViewCSSFile() { - const userDir = vscode.workspace.getConfiguration("coq.hacks") - .get("userSettingsLocation", null) - || extensionContext.asAbsolutePath(path.join(VIEW_PATH,'goals')); - return vscode.Uri.file(path.join(userDir,'proof-view.css')); -} - function proofViewFile(file: string = "") { return vscode.Uri.file(extensionContext.asAbsolutePath(path.join(VIEW_PATH,'goals',file))); } @@ -106,10 +97,8 @@ export class HtmlCoqView implements view.CoqView { } } - private async createBuffer() : Promise { try { - await HtmlCoqView.prepareStyleSheet(); this.coqViewUri = vscode.Uri.parse(`file://${proofViewHtmlPath().path.replace(/%3A/, ':')}`); console.log("Goals: " + decodeURIComponent(this.coqViewUri.with({scheme: 'file'}).toString())); } catch(err) { @@ -177,47 +166,8 @@ export class HtmlCoqView implements view.CoqView { this.currentSettings.fontFamily = vscode.workspace.getConfiguration("editor").get("fontFamily") as string; this.currentSettings.fontSize = `${vscode.workspace.getConfiguration("editor").get("fontSize") as number}pt`; this.currentSettings.fontWeight = vscode.workspace.getConfiguration("editor").get("fontWeight") as string; - this.currentSettings.cssFile = decodeURIComponent(proofViewCSSFile().toString()); this.currentSettings.prettifySymbolsMode = psm.isEnabled(); await this.sendMessage(Object.assign(this.currentSettings,{command: 'settings-update'})); } - private static async shouldResetStyleSheet() : Promise { - try { - const styleFile = proofViewCSSFile(); - if(!await nasync.fs.exists(styleFile.fsPath)) - return true; - const stat = await nasync.fs.stat(styleFile.fsPath); - if(stat.size < 5 && (await nasync.fs.readFile(styleFile.fsPath, 'utf8')).trim() === "") - return true; - } catch(err) { - console.error(err.toString()); - } - return false; - } - - /** makes sure that the style sheet is available */ - private static async prepareStyleSheet() { - try { - const styleFile = proofViewCSSFile(); - if(await HtmlCoqView.shouldResetStyleSheet() === true) { - const defaultFile = proofViewFile('default-proof-view.css'); - await nasync.fs.copyFile(defaultFile.fsPath,styleFile.fsPath); - } - } catch(err) { - console.error(err.toString()); - } - } - - - public static async customizeProofViewStyle() { - try { - await HtmlCoqView.prepareStyleSheet(); - const styleFile = proofViewCSSFile(); - const doc = await vscode.workspace.openTextDocument(styleFile.fsPath); - await vscode.window.showTextDocument(doc); - } catch(err) { - console.error(err.toString()); - } - } -} +} \ No newline at end of file diff --git a/client/src/extension.ts b/client/src/extension.ts index b3c8ee1..aff4969 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -5,7 +5,6 @@ import * as proto from './protocol'; import {CoqProject, CoqDocument} from './CoqProject'; import * as snippets from './Snippets'; import {initializeDecorations} from './Decorations'; -import {HtmlCoqView} from './HtmlCoqView'; import * as editorAssist from './EditorAssist'; import * as psm from './prettify-symbols-mode'; @@ -64,7 +63,6 @@ export function activate(context: ExtensionContext) { regTCmd('query.prompt.print', queryPrint); regTCmd('proofView.viewStateAt', viewProofStateAt); regTCmd('proofView.open', viewCurrentProofState); - regCmd('proofView.customizeProofViewStyle', customizeProofViewStyle); regProjectCmd('ltacProf.getResults', project.ltacProfGetResults); regCmd('display.toggle.implicitArguments', () => project.setDisplayOption(proto.DisplayOption.ImplicitArguments, proto.SetDisplayOption.Toggle)); regCmd('display.toggle.coercions', () => project.setDisplayOption(proto.DisplayOption.Coercions, proto.SetDisplayOption.Toggle)); @@ -193,8 +191,4 @@ function viewCurrentProofState(editor: TextEditor, edit: TextEditorEdit) { return withDocAsync(editor, async (doc) => doc.viewGoalState(editor) ) -} - -function customizeProofViewStyle() { - HtmlCoqView.customizeProofViewStyle(); } \ No newline at end of file diff --git a/html_views/.vscode/launch.json b/html_views/.vscode/launch.json deleted file mode 100644 index 5c906c6..0000000 --- a/html_views/.vscode/launch.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "Launch Chrome against localhost, with sourcemaps", - "type": "chrome", - "request": "launch", - // "url": "file:///c:/users/cj/Research/vscoq/client/html_views/goals/ContainProofView.html?host=127.0.0.1&port=7731", - "url": "file:///c:/users/cj/Research/vscoq/client/html_views/ltacprof/LtacProf.html?host=127.0.0.1&port=6388", - "sourceMaps": true, - "webRoot": "c:/users/cj/Research/vscoq/", - "userDataDir": "${workspaceRoot}/chrome", - "sourceMapPathOverrides": { - "file:///c:/users/cj/Research/vscoq/client/html_views/src/*": "c:/users/cj/Research/vscoq/html_views/src/*", - "file:///c:/users/cj/Research/vscoq/client/html_views/goals/*": "c:/users/cj/Research/vscoq/html_views/src/goals/*" - } - }, - { - "name": "Attach to Chrome, with sourcemaps", - "type": "chrome", - "request": "attach", - "port": 9222, - "sourceMaps": true, - "webRoot": "${workspaceRoot}" - } - ] -} \ No newline at end of file diff --git a/html_views/src/goals/ContainProofView.html b/html_views/src/goals/ContainProofView.html deleted file mode 100644 index 08edf3d..0000000 --- a/html_views/src/goals/ContainProofView.html +++ /dev/null @@ -1,19 +0,0 @@ - - - ProofView - - - - -