Skip to content

Commit

Permalink
package 15.05.23
Browse files Browse the repository at this point in the history
  • Loading branch information
akoreman committed May 15, 2023
1 parent 6178692 commit 9873534
Show file tree
Hide file tree
Showing 376 changed files with 9,517 additions and 1,797 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.21.0](https://github.com/ajaxorg/ace/compare/v1.20.0...v1.21.0) (2023-05-15)


### Features

* Custom empty message when no completion found ([#5158](https://github.com/ajaxorg/ace/issues/5158)) ([204aafa](https://github.com/ajaxorg/ace/commit/204aafa04c268e98655fb83b4877302a0f82fa4d))
* Special trigger characters to start autocomplete ([#5147](https://github.com/ajaxorg/ace/issues/5147)) ([c2cfc5a](https://github.com/ajaxorg/ace/commit/c2cfc5a9f1448f64e62f7652c995a48c4ea31ab3))


### Bug Fixes

* command bar command type ([#5168](https://github.com/ajaxorg/ace/issues/5168)) ([64c8253](https://github.com/ajaxorg/ace/commit/64c8253e3cd4348b7ecd3684dae057c8fd5f79b9))

## [1.20.0](https://github.com/ajaxorg/ace/compare/v1.19.0...v1.20.0) (2023-05-10)


Expand Down
1 change: 1 addition & 0 deletions ace-modules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ declare module 'ace-builds/src-noconflict/theme-dracula';
declare module 'ace-builds/src-noconflict/theme-dreamweaver';
declare module 'ace-builds/src-noconflict/theme-eclipse';
declare module 'ace-builds/src-noconflict/theme-github';
declare module 'ace-builds/src-noconflict/theme-github_dark';
declare module 'ace-builds/src-noconflict/theme-gob';
declare module 'ace-builds/src-noconflict/theme-gruvbox';
declare module 'ace-builds/src-noconflict/theme-gruvbox_dark_hard';
Expand Down
4 changes: 4 additions & 0 deletions ace.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,7 @@ export namespace Ace {
callback: CompleterCallback): void;
getDocTooltip?(item: Completion): undefined | string | Completion;
id?: string;
triggerCharacters?: string[]
}

export class AceInline {
Expand Down Expand Up @@ -1055,8 +1056,11 @@ export namespace Ace {
constructor();
autoInsert?: boolean;
autoSelect?: boolean;
autoShown?: boolean;
exactMatch?: boolean;
inlineEnabled?: boolean;
parentNode?: HTMLElement;
emptyMessage?(prefix: String): String;
getPopup(): AcePopup;
showPopup(editor: Editor, options: CompletionOptions): void;
detach(): void;
Expand Down
3 changes: 1 addition & 2 deletions css/ace.css
Original file line number Diff line number Diff line change
Expand Up @@ -928,9 +928,8 @@ width: calc(100% - 8px);
.ace_autocomplete_right .ace_line {
display: flex;
}
.ace_autocomplete_right .ace_completion-meta {
.ace_autocomplete_right .ace_completion-spacer {
flex: 1;
text-align: right;
}
/*inlineautocomplete.css*/
.ace_icon_svg.ace_arrow,
Expand Down
Binary file added css/github_dark-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/github_dark-2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 134 additions & 0 deletions css/theme/github_dark.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
.ace-github-dark .ace_gutter {
background: #24292e;
color: #7388b5
}

.ace-github-dark .ace_print-margin {
width: 1px;
background: #00204b
}

.ace-github-dark {
background-color: #24292e;
color: #FFFFFF
}

.ace-github-dark .ace_constant.ace_other,
.ace-github-dark .ace_cursor {
color: #FFFFFF
}

.ace-github-dark .ace_marker-layer .ace_selection {
background: #003F8E
}

.ace-github-dark.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #24292e;
}

.ace-github-dark .ace_marker-layer .ace_step {
background: rgb(127, 111, 19)
}

.ace-github-dark .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid #404F7D
}

.ace-github-dark .ace_marker-layer .ace_active-line {
background: #00346E
}

.ace-github-dark .ace_gutter-active-line {
background-color: #24292e
}

.ace-github-dark .ace_marker-layer .ace_selected-word {
border: 1px solid #003F8E
}

.ace-github-dark .ace_invisible {
color: #404F7D
}

.ace-github-dark .ace_keyword,
.ace-github-dark .ace_meta,
.ace-github-dark .ace_storage,
.ace-github-dark .ace_storage.ace_type,
.ace-github-dark .ace_support.ace_type {
color: #ff7b72
}

.ace-github-dark .ace_keyword.ace_operator {
color: #79c0ff
}

.ace-github-dark .ace_constant.ace_character,
.ace-github-dark .ace_constant.ace_language,
.ace-github-dark .ace_constant.ace_numeric,
.ace-github-dark .ace_keyword.ace_other.ace_unit,
.ace-github-dark .ace_support.ace_constant,
.ace-github-dark .ace_variable.ace_parameter {
color: #FFC58F
}

.ace-github-dark .ace_invalid {
color: #FFFFFF;
background-color: #F99DA5
}

.ace-github-dark .ace_invalid.ace_deprecated {
color: #FFFFFF;
background-color: #ff7b72
}

.ace-github-dark .ace_fold {
background-color: #BBDAFF;
border-color: #FFFFFF
}

.ace-github-dark .ace_entity.ace_name.ace_function,
.ace-github-dark .ace_support.ace_function,
.ace-github-dark .ace_variable {
color: #BBDAFF
}

.ace-github-dark .ace_support.ace_class,
.ace-github-dark .ace_support.ace_type {
color: #FFEEAD
}

.ace-github-dark .ace_heading,
.ace-github-dark .ace_markup.ace_heading,
.ace-github-dark .ace_string {
color: #9fcef6
}

.ace-github-dark .ace_entity.ace_name.ace_tag,
.ace-github-dark .ace_entity.ace_other.ace_attribute-name,
.ace-github-dark .ace_meta.ace_tag,
.ace-github-dark .ace_string.ace_regexp,
.ace-github-dark .ace_variable {
color: #FF9DA4
}

.ace-github-dark .ace_comment {
color: #7285B7
}

.ace-github-dark .ace_indent-guide {
background: url("../github_dark-1.png") right repeat-y
}

.ace-github-dark .ace_indent-guide-active {
background: url("../github_dark-2.png") right repeat-y;
}

.ace-github-dark .ace_constant.ace_buildin {
color: #0086B3;
}

.ace-github-dark .ace_variable.ace_language {
color: #ffffff;
}

72 changes: 52 additions & 20 deletions demo/kitchen-sink/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3815,7 +3815,8 @@ var themeData = [
["Tomorrow Night Bright", "tomorrow_night_bright", "dark"],
["Tomorrow Night 80s", "tomorrow_night_eighties", "dark"],
["Twilight", "twilight", "dark"],
["Vibrant Ink", "vibrant_ink", "dark"]
["Vibrant Ink", "vibrant_ink", "dark"],
["GitHub Dark", "github_dark", "dark"]
];
exports.themesByName = {};
exports.themes = themeData.map(function (data) {
Expand Down Expand Up @@ -4229,8 +4230,9 @@ var AcePopup = /** @class */ (function () {
function AcePopup(parentNode) {
var el = dom.createElement("div");
var popup = new $singleLineEditor(el);
if (parentNode)
if (parentNode) {
parentNode.appendChild(el);
}
el.style.display = "none";
popup.renderer.content.style.cursor = "default";
popup.renderer.setStyle("ace_autocomplete");
Expand Down Expand Up @@ -4373,6 +4375,7 @@ var AcePopup = /** @class */ (function () {
}
}
addToken(caption.slice(lastIndex, caption.length), "");
tokens.push({ type: "completion-spacer", value: " " });
if (data.meta)
tokens.push({ type: "completion-meta", value: data.meta });
if (data.message)
Expand Down Expand Up @@ -4402,7 +4405,7 @@ var AcePopup = /** @class */ (function () {
return selectionMarker.start.row;
};
popup.setRow = function (line) {
line = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length, line));
line = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length - 1, line));
if (selectionMarker.start.row != line) {
popup.selection.clearSelection();
selectionMarker.start.row = selectionMarker.end.row = line || 0;
Expand Down Expand Up @@ -4527,7 +4530,7 @@ var AcePopup = /** @class */ (function () {
}
return AcePopup;
}());
dom.importCssString("\n.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #CAD6FA;\n z-index: 1;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #3a674e;\n}\n.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid #abbffe;\n margin-top: -1px;\n background: rgba(233,233,253,0.4);\n position: absolute;\n z-index: 2;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid rgba(109, 150, 13, 0.8);\n background: rgba(58, 103, 78, 0.62);\n}\n.ace_completion-meta {\n opacity: 0.5;\n margin: 0 0.9em;\n}\n.ace_completion-message {\n color: blue;\n}\n.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #2d69c7;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #93ca12;\n}\n.ace_editor.ace_autocomplete {\n width: 300px;\n z-index: 200000;\n border: 1px lightgray solid;\n position: fixed;\n box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n line-height: 1.4;\n background: #fefefe;\n color: #111;\n}\n.ace_dark.ace_editor.ace_autocomplete {\n border: 1px #484747 solid;\n box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\n line-height: 1.4;\n background: #25282c;\n color: #c1c1c1;\n}\n.ace_autocomplete_right .ace_text-layer {\n width: calc(100% - 8px);\n}\n.ace_autocomplete_right .ace_line {\n display: flex;\n}\n.ace_autocomplete_right .ace_completion-meta {\n flex: 1;\n text-align: right;\n}\n", "autocompletion.css", false);
dom.importCssString("\n.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #CAD6FA;\n z-index: 1;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #3a674e;\n}\n.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid #abbffe;\n margin-top: -1px;\n background: rgba(233,233,253,0.4);\n position: absolute;\n z-index: 2;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid rgba(109, 150, 13, 0.8);\n background: rgba(58, 103, 78, 0.62);\n}\n.ace_completion-meta {\n opacity: 0.5;\n margin: 0 0.9em;\n}\n.ace_completion-message {\n color: blue;\n}\n.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #2d69c7;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #93ca12;\n}\n.ace_editor.ace_autocomplete {\n width: 300px;\n z-index: 200000;\n border: 1px lightgray solid;\n position: fixed;\n box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n line-height: 1.4;\n background: #fefefe;\n color: #111;\n}\n.ace_dark.ace_editor.ace_autocomplete {\n border: 1px #484747 solid;\n box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\n line-height: 1.4;\n background: #25282c;\n color: #c1c1c1;\n}\n.ace_autocomplete_right .ace_text-layer {\n width: calc(100% - 8px);\n}\n.ace_autocomplete_right .ace_line {\n display: flex;\n}\n.ace_autocomplete_right .ace_completion-spacer {\n flex: 1;\n}\n", "autocompletion.css", false);
exports.AcePopup = AcePopup;
exports.$singleLineEditor = $singleLineEditor;
exports.getAriaId = getAriaId;
Expand Down Expand Up @@ -5607,6 +5610,17 @@ exports.getCompletionPrefix = function (editor) {
}.bind(this));
return prefix || this.retrievePrecedingIdentifier(line, pos.column);
};
exports.triggerAutocomplete = function (editor) {
var pos = editor.getCursorPosition();
var line = editor.session.getLine(pos.row);
var column = (pos.column === 0) ? 0 : pos.column - 1;
var previousChar = line[column];
return editor.completers.some(function (el) {
if (el.triggerCharacters && Array.isArray(el.triggerCharacters)) {
return el.triggerCharacters.includes(previousChar);
}
});
};

});

Expand All @@ -5627,10 +5641,12 @@ var Autocomplete = /** @class */ (function () {
function Autocomplete() {
this.autoInsert = false;
this.autoSelect = true;
this.autoShown = false;
this.exactMatch = false;
this.inlineEnabled = false;
this.keyboardHandler = new HashHandler();
this.keyboardHandler.bindKeys(this.commands);
this.parentNode = null;
this.blurListener = this.blurListener.bind(this);
this.changeListener = this.changeListener.bind(this);
this.mousedownListener = this.mousedownListener.bind(this);
Expand All @@ -5641,7 +5657,7 @@ var Autocomplete = /** @class */ (function () {
this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
}
Autocomplete.prototype.$init = function () {
this.popup = new AcePopup(document.body || document.documentElement);
this.popup = new AcePopup(this.parentNode || document.body || document.documentElement);
this.popup.on("click", function (e) {
this.insertMatch();
e.stop();
Expand Down Expand Up @@ -5788,6 +5804,8 @@ var Autocomplete = /** @class */ (function () {
data = this.popup.getData(this.popup.getRow());
if (!data)
return false;
if (data.value === "") // Explicitly given nothing to insert, e.g. "No suggestion state"
return this.detach();
var completions = this.completions;
var result = this.getCompletionProvider().insertMatch(this.editor, data, completions.filterText, options);
if (this.completions == completions)
Expand Down Expand Up @@ -5851,11 +5869,24 @@ var Autocomplete = /** @class */ (function () {
var filtered = completions.filtered;
var prefix = util.getCompletionPrefix(this.editor);
if (finished) {
if (!filtered.length)
if (!filtered.length) {
var emptyMessage = !this.autoShown && this.emptyMessage;
if (typeof emptyMessage == "function")
emptyMessage = this.emptyMessage(prefix);
if (emptyMessage) {
var completionsForEmpty = [{
caption: this.emptyMessage(prefix),
value: ""
}];
this.completions = new FilteredList(completionsForEmpty);
this.openPopup(this.editor, prefix, keepPopupPosition);
return;
}
return this.detach();
}
if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet)
return this.detach();
if (this.autoInsert && filtered.length == 1)
if (this.autoInsert && !this.autoShown && filtered.length == 1)
return this.insertMatch(filtered[0]);
}
this.completions = completions;
Expand Down Expand Up @@ -5908,7 +5939,7 @@ var Autocomplete = /** @class */ (function () {
tooltipNode.textContent = item.docText;
}
if (!tooltipNode.parentNode)
document.body.appendChild(tooltipNode);
this.popup.container.appendChild(this.tooltipNode);
var popup = this.popup;
var rect = popup.container.getBoundingClientRect();
tooltipNode.style.top = popup.container.style.top;
Expand Down Expand Up @@ -6020,6 +6051,7 @@ Autocomplete.startCommand = {
var completer = Autocomplete.for(editor);
completer.autoInsert = false;
completer.autoSelect = true;
completer.autoShown = false;
completer.showPopup(editor, options);
completer.cancelContextMenu();
},
Expand Down Expand Up @@ -6751,9 +6783,10 @@ var doLiveAutocomplete = function (e) {
}
else if (e.command.name === "insertstring") {
var prefix = util.getCompletionPrefix(editor);
if (prefix && !hasCompleter) {
var triggerAutocomplete = util.triggerAutocomplete(editor);
if ((prefix || triggerAutocomplete) && !hasCompleter) {
var completer = Autocomplete.for(editor);
completer.autoInsert = false;
completer.autoShown = true;
completer.showPopup(editor);
}
}
Expand Down Expand Up @@ -7959,10 +7992,8 @@ var layout = require("./layout");
var util = require("./util");
var saveOption = util.saveOption;


var ElasticTabstopsLite = require("ace/ext/elastic_tabstops_lite").ElasticTabstopsLite;

var IncrementalSearch = require("ace/incremental_search").IncrementalSearch;
require("ace/ext/elastic_tabstops_lite");
require("ace/incremental_search");

var TokenTooltip = require("./token_tooltip").TokenTooltip;
require("ace/config").defineOptions(Editor.prototype, "editor", {
Expand Down Expand Up @@ -8002,9 +8033,9 @@ var MarkerGroup = require("ace/marker_group").MarkerGroup;
var docTooltip = new HoverTooltip();
function loadLanguageProvider(editor) {
require([
"https://www.unpkg.com/ace-linters/build/ace-linters.js"
"https://mkslanc.github.io/ace-linters/build/ace-linters.js"
], function(m) {
var languageProvider = m.LanguageProvider.fromCdn("https://www.unpkg.com/ace-linters/build", {
var languageProvider = m.LanguageProvider.fromCdn("https://mkslanc.github.io/ace-linters/build", {
functionality: {
hover: true,
completion: {
Expand Down Expand Up @@ -8051,7 +8082,6 @@ function loadLanguageProvider(editor) {
function showAnnotations(session, diagnostics) {
session.clearAnnotations();
let annotations = diagnostics.map((el) => {
console.log(el.severity, el)
return {
row: el.range.start.line,
column: el.range.start.character,
Expand Down Expand Up @@ -8083,11 +8113,13 @@ function loadLanguageProvider(editor) {

languageProvider.doHover(session, docPos, function(hover) {
var errorMarker = session.state?.diagnosticMarkers.getMarkerAtPosition(docPos);

if (!errorMarker && !hover.content) return;

var range = hover?.range || errorMarker?.range;
if (!range) return;
var hoverNode = hover && dom.buildDom(["div", {}])
range = range ? Range.fromPoints(range.start, range.end) : session.getWordRange(docPos.row, docPos.column);
var hoverNode = hover && dom.buildDom(["div", {}]);
if (hoverNode) {
hover.content.text = hover.content.text.replace(/(?!^)`{3}/gm, "\n$&");
hoverNode.innerHTML = languageProvider.getTooltipText(hover);
};

Expand Down

0 comments on commit 9873534

Please sign in to comment.