diff --git a/metadata.js b/metadata.js index 1ad84211..b87aee0e 100644 --- a/metadata.js +++ b/metadata.js @@ -63,4 +63,4 @@ self.METADATA = METADATA; } -})(); \ No newline at end of file +})(); diff --git a/test/index.js b/test/index.js index d026f628..368a86b8 100644 --- a/test/index.js +++ b/test/index.js @@ -3,24 +3,12 @@ define(['require', './samples'], function(require, SAMPLES) { var domutils = require('vs/base/browser/dom'); -var WRAPPING_COLUMN = 300; - var model = monaco.editor.createModel('', 'plaintext'); var editor = monaco.editor.create(document.getElementById('container'), { model: model, - readOnly: false, glyphMargin: true, - wrappingColumn: WRAPPING_COLUMN, - outlineMarkers: false, - renderWhitespace: true, - minimap: { - enabled: true - } - // scrollbar: { - // verticalHasArrows: true, - // horizontalHasArrows: true - // } + renderWhitespace: true }); editor.addCommand({ @@ -42,7 +30,6 @@ editor.addAction({ } }); - var currentSamplePromise = null; var samplesData = {}; SAMPLES.sort(function(a,b) { @@ -170,16 +157,8 @@ function createToolbar(editor) { } }; })())); - - bar.appendChild(createButton("Colorize", function(e) { - var out = document.getElementById('colorizeOutput'); - monaco.editor.colorize(editor.getModel().getValue(), editor.getModel().getMode().getId(), { tabSize: 4 }).then(function(r) { - out.innerHTML = r; - }); - })); } - function createButton(label, onClick) { var result = document.createElement("button"); result.innerHTML = label; @@ -187,117 +166,129 @@ function createButton(label, onClick) { return result; } - function createOptions(editor) { var options = document.getElementById('options'); - options.appendChild(createOptionToggle(editor, 'lineNumbers', function(config) { - return config.viewInfo.lineNumbers; - }, function(editor, newValue) { - editor.updateOptions({ lineNumbers: newValue }); - })); - - options.appendChild(createOptionToggle(editor, 'glyphMargin', function(config) { - return config.viewInfo.glyphMargin; - }, function(editor, newValue) { - editor.updateOptions({ glyphMargin: newValue }); - })); - - options.appendChild(createOptionToggle(editor, 'roundedSelection', function(config) { - return config.viewInfo.roundedSelection; - }, function(editor, newValue) { - editor.updateOptions({ roundedSelection: newValue }); - })); + options.appendChild(createOptionToggle( + editor, + 'lineNumbers', + function(config) { + return config.viewInfo.renderLineNumbers; + }, + function(editor, newValue) { + editor.updateOptions({ lineNumbers: newValue ? 'on': 'off' }); + } + )); + + options.appendChild(createOptionToggle( + editor, + 'glyphMargin', + function(config) { + return config.viewInfo.glyphMargin; + }, + function(editor, newValue) { + editor.updateOptions({ glyphMargin: newValue }); + } + )); + + options.appendChild(createOptionToggle( + editor, + 'minimap', + function(config) { + return config.viewInfo.minimap.enabled; + }, + function(editor, newValue) { + editor.updateOptions({ minimap: { enabled: newValue } }); + } + )); + + options.appendChild(createOptionToggle( + editor, + 'roundedSelection', + function(config) { + return config.viewInfo.roundedSelection; + }, + function(editor, newValue) { + editor.updateOptions({ roundedSelection: newValue }); + } + )); + + options.appendChild(createOptionToggle( + editor, + 'scrollBeyondLastLine', + function(config) { + return config.viewInfo.scrollBeyondLastLine; + }, function(editor, newValue) { + editor.updateOptions({ scrollBeyondLastLine: newValue }); + } + )); + + options.appendChild(createOptionToggle( + editor, + 'renderWhitespace', + function(config) { + return config.viewInfo.renderWhitespace; + }, function(editor, newValue) { + editor.updateOptions({ renderWhitespace: newValue }); + } + )); + + options.appendChild(createOptionToggle( + editor, + 'light', + function(config) { + return false;//config.viewInfo.theme === 'vs-dark'; + }, function(editor, newValue) { + monaco.editor.setTheme('vs'); + // editor.updateOptions({ theme: newValue ? 'vs-dark' : 'vs' }); + } + )); options.appendChild(createOptionToggle(editor, 'dark', function(config) { - return config.viewInfo.theme === 'vs-dark'; + return false;//config.viewInfo.theme === 'vs-dark'; }, function(editor, newValue) { - editor.updateOptions({ theme: newValue ? 'vs-dark' : 'vs' }); + monaco.editor.setTheme('vs-dark'); + // editor.updateOptions({ theme: newValue ? 'vs-dark' : 'vs' }); })); options.appendChild(createOptionToggle(editor, 'hc-black', function(config) { - return config.viewInfo.theme === 'hc-black'; + return false; + //return config.viewInfo.theme === 'hc-black'; }, function(editor, newValue) { + monaco.editor.setTheme('hc-black'); editor.updateOptions({ theme: newValue ? 'hc-black' : 'vs' }); })); - options.appendChild(createOptionToggle(editor, 'readOnly', function(config) { - return config.readOnly; - }, function(editor, newValue) { - editor.updateOptions({ readOnly: newValue }); - })); - - options.appendChild(createOptionToggle(editor, 'hideCursorInOverviewRuler', function(config) { - return config.viewInfo.hideCursorInOverviewRuler; - }, function(editor, newValue) { - editor.updateOptions({ hideCursorInOverviewRuler: newValue }); - })); - - options.appendChild(createOptionToggle(editor, 'scrollBeyondLastLine', function(config) { - return config.viewInfo.scrollBeyondLastLine; - }, function(editor, newValue) { - editor.updateOptions({ scrollBeyondLastLine: newValue }); - })); - - options.appendChild(createOptionToggle(editor, 'wordWrap', function(config) { - return config.wrappingInfo.isViewportWrapping; - }, function(editor, newValue) { - editor.updateOptions({ wrappingColumn: newValue ? 0 : WRAPPING_COLUMN }); - })); - - options.appendChild(createOptionToggle(editor, 'quickSuggestions', function(config) { - return config.contribInfo.quickSuggestions; - }, function(editor, newValue) { - editor.updateOptions({ quickSuggestions: newValue }); - })); - - options.appendChild(createOptionToggle(editor, 'iconsInSuggestions', function(config) { - return config.contribInfo.iconsInSuggestions; - }, function(editor, newValue) { - editor.updateOptions({ iconsInSuggestions: newValue }); - })); - - options.appendChild(createOptionToggle(editor, 'autoClosingBrackets', function(config) { - return config.autoClosingBrackets; - }, function(editor, newValue) { - editor.updateOptions({ autoClosingBrackets: newValue }); - })); - - options.appendChild(createOptionToggle(editor, 'formatOnType', function(config) { - return config.contribInfo.formatOnType; - }, function(editor, newValue) { - editor.updateOptions({ formatOnType: newValue }); - })); - - options.appendChild(createOptionToggle(editor, 'suggestOnTriggerCharacters', function(config) { - return config.contribInfo.suggestOnTriggerCharacters; - }, function(editor, newValue) { - editor.updateOptions({ suggestOnTriggerCharacters: newValue }); - })); - - options.appendChild(createOptionToggle(editor, 'acceptSuggestionOnEnter', function(config) { - return config.contribInfo.acceptSuggestionOnEnter; - }, function(editor, newValue) { - editor.updateOptions({ acceptSuggestionOnEnter: newValue }); - })); - - options.appendChild(createOptionToggle(editor, 'selectionHighlight', function(config) { - return config.contribInfo.selectionHighlight; - }, function(editor, newValue) { - editor.updateOptions({ selectionHighlight: newValue }); - })); - - options.appendChild(createOptionToggle(editor, 'folding', function(config) { - return config.contribInfo.folding; - }, function(editor, newValue) { - editor.updateOptions({ folding: newValue }); - })); - - options.appendChild(createOptionToggle(editor, 'renderWhitespace', function(config) { - return config.viewInfo.renderWhitespace; - }, function(editor, newValue) { - editor.updateOptions({ renderWhitespace: newValue }); - })); + options.appendChild(createOptionToggle( + editor, + 'readOnly', + function(config) { + return config.readOnly; + }, + function(editor, newValue) { + editor.updateOptions({ readOnly: newValue }); + } + )); + + options.appendChild(createOptionToggle( + editor, + 'wordWrap', + function(config) { + return config.wrappingInfo.isViewportWrapping; + }, function(editor, newValue) { + editor.updateOptions({ wordWrap: newValue ? 'on' : 'off' }); + } + )); + + options.appendChild(createOptionToggle( + editor, + 'folding', + function(config) { + return config.contribInfo.folding; + }, function(editor, newValue) { + editor.updateOptions({ folding: newValue }); + } + )); }