Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Ported Cloud9 Find Replace Plugin to Ace Editor with Enhancements #5502

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 43 additions & 1 deletion ace-internal.d.ts
Expand Up @@ -26,6 +26,7 @@ export namespace Ace {
type GutterHandler = import("./src/mouse/default_gutter_handler").GutterHandler;
type DragdropHandler = import("./src/mouse/dragdrop_handler").DragdropHandler;
type AppConfig = import("./src/lib/app_config").AppConfig;
type SearchTracker = import("./src/ext/search/async_search").SearchTracker;


type AfterLoadCallback = (err: Error | null, module: unknown) => void;
Expand Down Expand Up @@ -645,6 +646,14 @@ export namespace Ace {
re: RegExp;
}

interface ExtendedSearchOptions extends SearchOptions {
source: string;
flags: string;
regex?: RegExp;
findAll: boolean;
indexRange?: number[];
}

interface Point {
row: number;
column: number;
Expand Down Expand Up @@ -783,7 +792,10 @@ export namespace Ace {
closingBracketBlock(session: EditSession, bracket: string, row: number, column: number, typeRe?: RegExp): Range | undefined;
}

type BehaviorAction = (state: string, action: string, editor: Editor, session: EditSession, text: string | Range) => ({ text: string, selection: number[] } | Range) & { [key: string]: any } | undefined;
type BehaviorAction = (state: string, action: string, editor: Editor, session: EditSession, text: string | Range) => ({
text: string,
selection: number[]
} | Range) & { [key: string]: any } | undefined;
type BehaviorMap = Record<string, Record<string, BehaviorAction>>;

interface Behaviour {
Expand Down Expand Up @@ -940,8 +952,10 @@ export namespace Ace {
callback: CompleterCallback): void;

getDocTooltip?(item: Completion): void | string | Completion;

onSeen?: (editor: Ace.Editor, completion: Completion) => void;
onInsert?: (editor: Ace.Editor, completion: Completion) => void;

cancel?(): void;

id?: string;
Expand Down Expand Up @@ -1163,6 +1177,32 @@ export namespace Ace {
className?: string,
value: string,
}>>

export type SearchResultCallbackArgs = {
start?: Position,
end?: Position,
total: number,
current: number,
wrapped?: boolean,
value?: string,
startIndex?: number
} | {
value: string,
matches: number[],
offset: number,
start?: Position,
end?: Position,
} | "waiting" | null;

export interface InputEditor extends Editor {
saveHistory?();

session: InputEditorEditSession
}

export interface InputEditorEditSession extends EditSession {
searchHistory?: string[];
}
}


Expand Down Expand Up @@ -1202,6 +1242,7 @@ export type CommandBarTooltip = Ace.CommandBarTooltip;
declare global {
interface Element {
setAttribute(name: string, value: boolean): void;

setAttribute(name: string, value: number): void;
}
}
Expand Down Expand Up @@ -1311,6 +1352,7 @@ declare module "./src/edit_session" {
$occurMatchingLines?: any,
$useEmacsStyleLineStart?: boolean,
$selectLongWords?: boolean,
searchTracker?: Ace.SearchTracker
}

}
Expand Down
4 changes: 2 additions & 2 deletions src/editor.js
Expand Up @@ -881,8 +881,8 @@ class Editor {
}

/**
*
* @param {string | string[]} command
*
* @param {string | string[] | import("../ace-internal").Ace.Command} command
* @param [args]
* @return {boolean}
*/
Expand Down