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

chore: small type fixes #5690

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
Loading