WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ace-internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ export namespace Ace {

interface EditorEvents {
"change": (delta: Delta) => void;
"changeSelection": () => void;
"changeSelection": (...args: any) => void;
"input": () => void;
/**
* Emitted whenever the [[EditSession]] changes.
Expand Down Expand Up @@ -598,7 +598,7 @@ export namespace Ace {
/**
* Emitted when the cursor selection changes.
**/
"changeSelection": () => void;
"changeSelection": (...args: any) => void;
}

interface MultiSelectionEvents extends SelectionEvents {
Expand Down
4 changes: 2 additions & 2 deletions ace.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ declare module "ace-code" {
}
interface EditorEvents {
"change": (delta: Delta) => void;
"changeSelection": () => void;
"changeSelection": (...args: any) => void;
"input": () => void;
/**
* Emitted whenever the [[EditSession]] changes.
Expand Down Expand Up @@ -515,7 +515,7 @@ declare module "ace-code" {
/**
* Emitted when the cursor selection changes.
**/
"changeSelection": () => void;
"changeSelection": (...args: any) => void;
}
interface MultiSelectionEvents extends SelectionEvents {
"multiSelect": () => void;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"eslint": "^8.20.0",
"istanbul": "^0.4.5",
"standard-version": "^9.3.2",
"typescript": "5.8.3"
"typescript": "5.9.2"
},
"mappings": {
"ace": "."
Expand Down
11 changes: 11 additions & 0 deletions src/layer/gutter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
"use strict";
/**
* @typedef {import("../edit_session").EditSession} EditSession
* @typedef {import("../editor").Editor} Editor
* @typedef {import("../../ace-internal").Ace.LayerConfig} LayerConfig
*/
/**
* @typedef {Object} GutterRenderer
* @property {function(EditSession, number): string} getText - Gets the text to display for a given row
* @property {function(EditSession, number, Object): number} getWidth - Calculates the width needed for the gutter
* @property {function(Event|null, Editor): void} [update] - Updates the gutter display
* @property {function(Editor): void} [attach] - Attaches the renderer to an editor
* @property {function(Editor): void} [detach] - Detaches the renderer from an editor
*/

var dom = require("../lib/dom");
var oop = require("../lib/oop");
var lang = require("../lib/lang");
Expand Down Expand Up @@ -572,6 +582,7 @@ class Gutter{
* @param {boolean} show
*/
setShowLineNumbers(show) {
/**@type{GutterRenderer | string}*/
this.$renderer = !show && {
getWidth: function() {return 0;},
getText: function() {return "";}
Expand Down
2 changes: 1 addition & 1 deletion types/ace-ext.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ declare module "ace-code/src/ext/diff/scroll_diff_decorator" {
import { Decorator } from "ace-code/src/layer/decorators";
}
declare module "ace-code/src/ext/diff/styles-css" {
export const cssText: "\n/*\n * Line Markers\n */\n.ace_diff {\n position: absolute;\n z-index: 0;\n}\n.ace_diff.inline {\n z-index: 20;\n}\n/*\n * Light Colors \n */\n.ace_diff.insert {\n background-color: #EFFFF1;\n}\n.ace_diff.delete {\n background-color: #FFF1F1;\n}\n.ace_diff.aligned_diff {\n background: rgba(206, 194, 191, 0.26);\n background: repeating-linear-gradient(\n 45deg,\n rgba(122, 111, 108, 0.26),\n rgba(122, 111, 108, 0.26) 5px,\n rgba(0, 0, 0, 0) 5px,\n rgba(0, 0, 0, 0) 10px \n );\n}\n\n.ace_diff.insert.inline {\n background-color: rgb(74 251 74 / 18%); \n}\n.ace_diff.delete.inline {\n background-color: rgb(251 74 74 / 15%);\n}\n\n.ace_diff.delete.inline.empty {\n background-color: rgba(255, 128, 79, 0.7);\n width: 2px !important;\n}\n\n.ace_diff.insert.inline.empty {\n background-color: rgba(49, 230, 96, 0.7);\n width: 2px !important;\n}\n\n.ace_diff-active-line {\n border-bottom: 1px solid;\n border-top: 1px solid;\n background: transparent;\n position: absolute;\n box-sizing: border-box;\n border-color: #9191ac;\n}\n\n.ace_dark .ace_diff-active-line {\n background: transparent;\n border-color: #75777a;\n}\n \n\n/* gutter changes */\n.ace_mini-diff_gutter-enabled > .ace_gutter-cell,\n.ace_mini-diff_gutter-enabled > .ace_gutter-cell_svg-icons {\n padding-right: 13px;\n}\n\n.ace_mini-diff_gutter_other > .ace_gutter-cell,\n.ace_mini-diff_gutter_other > .ace_gutter-cell_svg-icons {\n display: none;\n}\n\n.ace_mini-diff_gutter_other {\n pointer-events: none;\n}\n\n\n.ace_mini-diff_gutter-enabled > .mini-diff-added {\n background-color: #EFFFF1;\n border-left: 3px solid #2BB534;\n padding-left: 16px;\n display: block;\n}\n\n.ace_mini-diff_gutter-enabled > .mini-diff-deleted {\n background-color: #FFF1F1;\n border-left: 3px solid #EA7158;\n padding-left: 16px;\n display: block;\n}\n\n\n.ace_mini-diff_gutter-enabled > .mini-diff-added:after {\n position: absolute;\n right: 2px;\n content: \"+\";\n color: darkgray;\n background-color: inherit;\n}\n\n.ace_mini-diff_gutter-enabled > .mini-diff-deleted:after {\n position: absolute;\n right: 2px;\n content: \"-\";\n color: darkgray;\n background-color: inherit;\n}\n.ace_fade-fold-widgets:hover > .ace_folding-enabled > .mini-diff-added:after,\n.ace_fade-fold-widgets:hover > .ace_folding-enabled > .mini-diff-deleted:after {\n display: none;\n}\n\n.ace_diff_other .ace_selection {\n filter: drop-shadow(1px 2px 3px darkgray);\n}\n\n.ace_hidden_marker-layer .ace_bracket {\n display: none;\n}\n\n\n\n/*\n * Dark Colors \n */\n\n.ace_dark .ace_diff.insert {\n background-color: #212E25;\n}\n.ace_dark .ace_diff.delete {\n background-color: #3F2222;\n}\n\n.ace_dark .ace_mini-diff_gutter-enabled > .mini-diff-added {\n background-color: #212E25;\n border-left-color:#00802F;\n}\n\n.ace_dark .ace_mini-diff_gutter-enabled > .mini-diff-deleted {\n background-color: #3F2222;\n border-left-color: #9C3838;\n}\n\n";
export const cssText: "\n/*\n * Line Markers\n */\n.ace_diff {\n position: absolute;\n z-index: 0;\n}\n.ace_diff.inline {\n z-index: 20;\n}\n/*\n * Light Colors \n */\n.ace_diff.insert {\n background-color: #EFFFF1;\n}\n.ace_diff.delete {\n background-color: #FFF1F1;\n}\n.ace_diff.aligned_diff {\n background: rgba(206, 194, 191, 0.26);\n background: repeating-linear-gradient(\n 45deg,\n rgba(122, 111, 108, 0.26),\n rgba(122, 111, 108, 0.26) 5px,\n rgba(0, 0, 0, 0) 5px,\n rgba(0, 0, 0, 0) 10px \n );\n}\n\n.ace_diff.insert.inline {\n background-color: rgb(74 251 74 / 18%); \n}\n.ace_diff.delete.inline {\n background-color: rgb(251 74 74 / 15%);\n}\n\n.ace_diff.delete.inline.empty {\n background-color: rgba(255, 128, 79, 0.7);\n width: 2px !important;\n}\n\n.ace_diff.insert.inline.empty {\n background-color: rgba(49, 230, 96, 0.7);\n width: 2px !important;\n}\n\n.ace_diff-active-line {\n border-bottom: 1px solid;\n border-top: 1px solid;\n background: transparent;\n position: absolute;\n box-sizing: border-box;\n border-color: #9191ac;\n}\n\n.ace_dark .ace_diff-active-line {\n background: transparent;\n border-color: #75777a;\n}\n \n\n/* gutter changes */\n.ace_mini-diff_gutter-enabled > .ace_gutter-cell,\n.ace_mini-diff_gutter-enabled > .ace_gutter-cell_svg-icons {\n padding-right: 13px;\n}\n\n.ace_mini-diff_gutter_other > .ace_gutter-cell,\n.ace_mini-diff_gutter_other > .ace_gutter-cell_svg-icons {\n display: none;\n}\n\n.ace_mini-diff_gutter_other {\n pointer-events: none;\n}\n\n\n.ace_mini-diff_gutter-enabled > .mini-diff-added {\n background-color: #EFFFF1;\n border-left: 3px solid #2BB534;\n padding-left: 16px;\n display: block;\n}\n\n.ace_mini-diff_gutter-enabled > .mini-diff-deleted {\n background-color: #FFF1F1;\n border-left: 3px solid #EA7158;\n padding-left: 16px;\n display: block;\n}\n\n\n.ace_mini-diff_gutter-enabled > .mini-diff-added:after {\n position: absolute;\n right: 2px;\n content: \"+\";\n background-color: inherit;\n}\n\n.ace_mini-diff_gutter-enabled > .mini-diff-deleted:after {\n position: absolute;\n right: 2px;\n content: \"-\";\n background-color: inherit;\n}\n.ace_fade-fold-widgets:hover > .ace_folding-enabled > .mini-diff-added:after,\n.ace_fade-fold-widgets:hover > .ace_folding-enabled > .mini-diff-deleted:after {\n display: none;\n}\n\n.ace_diff_other .ace_selection {\n filter: drop-shadow(1px 2px 3px darkgray);\n}\n\n.ace_hidden_marker-layer .ace_bracket,\n.ace_hidden_marker-layer .ace_error_bracket {\n display: none;\n}\n\n\n\n/*\n * Dark Colors \n */\n\n.ace_dark .ace_diff.insert {\n background-color: #212E25;\n}\n.ace_dark .ace_diff.delete {\n background-color: #3F2222;\n}\n\n.ace_dark .ace_mini-diff_gutter-enabled > .mini-diff-added {\n background-color: #212E25;\n border-left-color:#00802F;\n}\n\n.ace_dark .ace_mini-diff_gutter-enabled > .mini-diff-deleted {\n background-color: #3F2222;\n border-left-color: #9C3838;\n}\n\n";
}
declare module "ace-code/src/ext/diff/gutter_decorator" {
export class MinimalGutterDiffDecorator {
Expand Down
23 changes: 23 additions & 0 deletions types/ace-modules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,30 @@ declare module "ace-code/src/layer/gutter" {
}): "markers" | "foldWidgets";
}
export type EditSession = import("ace-code/src/edit_session").EditSession;
export type Editor = import("ace-code/src/editor").Editor;
export type LayerConfig = import("ace-code").Ace.LayerConfig;
export type GutterRenderer = {
/**
* - Gets the text to display for a given row
*/
getText: (arg0: EditSession, arg1: number) => string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there are reason why we call these arguments arg0... instead of editSession ...?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it's in draft state... I am patching more generic solution, that would handle this for all event types, not only for onChangeSelection. But I'll take this into account and rename arguments

/**
* - Calculates the width needed for the gutter
*/
getWidth: (arg0: EditSession, arg1: number, arg2: any) => number;
/**
* - Updates the gutter display
*/
update?: (arg0: Event | null, arg1: Editor) => void;
/**
* - Attaches the renderer to an editor
*/
attach?: (arg0: Editor) => void;
/**
* - Detaches the renderer from an editor
*/
detach?: (arg0: Editor) => void;
};
import { Lines } from "ace-code/src/layer/lines";
namespace Ace {
type EventEmitter<T extends {
Expand Down
Loading