Skip to content

Commit

Permalink
chore: small type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alice Koreman committed Dec 6, 2024
1 parent 3eaf667 commit 0c5dc55
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ace-internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ export namespace Ace {
*/
$quotes: { [quote: string]: string };
HighlightRules: {
new(config: any): HighlightRules
new(config?: any): HighlightRules
}; //TODO: fix this
foldingRules?: FoldMode;
$behaviour?: Behaviour;
Expand Down
2 changes: 1 addition & 1 deletion ace.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ declare module "ace-code" {
}
interface SyntaxMode {
HighlightRules: {
new(config: any): HighlightRules;
new(config?: any): HighlightRules;
}; //TODO: fix this
foldingRules?: FoldMode;
/**
Expand Down
2 changes: 1 addition & 1 deletion src/edit_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class EditSession {
/**
* End current Ace operation.
* Emits "beforeEndOperation" event just before clearing everything, where the current operation can be accessed through `curOp` property.
* @param {any} e
* @param {any} [e]
*/
endOperation(e) {
if (this.curOp) {
Expand Down
5 changes: 5 additions & 0 deletions src/ext/searchbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ class SearchBox {
}
});

/**
* @type {{schedule: (timeout?: number) => void}}
* @external
*/
this.$onChange = lang.delayedCall(function() {
_this.find(false, false);
});
Expand Down Expand Up @@ -158,6 +162,7 @@ class SearchBox {

/**
* @param {boolean} [preventScroll]
* @external
*/
$syncOptions(preventScroll) {
dom.setCssClass(this.replaceOption, "checked", this.searchRange);
Expand Down
10 changes: 9 additions & 1 deletion tool/ace_declaration_generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ function fixDeclaration(content, aceNamespacePath) {

const startsWithDollar = ts.isIdentifier(node.name) && /^[$_]/.test(node.name.text);

if (isPrivate || startsWithDollar || hasInternalTag(node)) {
if (isPrivate || (startsWithDollar && !hasExternalTag(node)) || hasInternalTag(node)) {
return ts.factory.createNotEmittedStatement(node);
}
}
Expand Down Expand Up @@ -459,6 +459,14 @@ function hasInternalTag(node) {
return jsDocs.length > 0;
}

function hasExternalTag(node) {
const sourceFile = node.getSourceFile();
if (!sourceFile) return false;

const jsDocs = ts.getJSDocTags(node).filter(tag => tag.tagName.text === 'external');
return jsDocs.length > 0;
}

function createMinimalLanguageServiceHost() {
return {
files: {},
Expand Down
11 changes: 11 additions & 0 deletions types/ace-ext.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,19 @@ declare module "ace-code/src/ext/searchbox" {
searchInput: HTMLInputElement;
replaceInput: HTMLInputElement;
searchCounter: HTMLElement;
/**
*
* @external
*/
$onChange: {
schedule: (timeout?: number) => void;
};
setSearchRange(range: any): void;
searchRangeMarker: number;
/**
* @external
*/
$syncOptions(preventScroll?: boolean): void;
highlight(re?: RegExp): void;
find(skipCurrent: boolean, backwards: boolean, preventScroll?: any): void;
updateCounter(): void;
Expand Down
2 changes: 1 addition & 1 deletion types/ace-modules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3767,7 +3767,7 @@ declare module "ace-code/src/edit_session" {
* End current Ace operation.
* Emits "beforeEndOperation" event just before clearing everything, where the current operation can be accessed through `curOp` property.
*/
endOperation(e: any): void;
endOperation(e?: any): void;
/**
* Sets the `EditSession` to point to a new `Document`. If a `BackgroundTokenizer` exists, it also points to `doc`.
*
Expand Down

0 comments on commit 0c5dc55

Please sign in to comment.