Skip to content

Commit

Permalink
Merge branch 'themoeway:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenmk authored Dec 16, 2023
2 parents fd373d6 + 64e4598 commit 92124eb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 25 deletions.
12 changes: 6 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
"markdown.extension.toc.levels": "1..3",
"[javascript]": {
"editor.codeActionsOnSave": {
"source.addMissingImports": true,
"source.organizeImports": true,
"source.fixAll.eslint": true
"source.addMissingImports": "explicit",
"source.organizeImports": "explicit",
"source.fixAll.eslint": "explicit"
},
},
"[typescript]": {
"editor.codeActionsOnSave": {
"source.addMissingImports": false,
"source.organizeImports": false,
"source.fixAll.eslint": true
"source.addMissingImports": "never",
"source.organizeImports": "never",
"source.fixAll.eslint": "explicit"
},
},
"eslint.format.enable": true,
Expand Down
19 changes: 3 additions & 16 deletions ext/js/dom/document-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,9 @@ export class DocumentUtil {
* @param {boolean} layoutAwareScan Whether or not layout-aware scan mode should be used.
* @param {number} extent The length of the sentence to extract.
* @param {boolean} terminateAtNewlines Whether or not a sentence should be terminated at newline characters.
* @param {Map<string, *[]>} terminatorMap A mapping of characters that terminate a sentence.
* Format:
* ```js
* new Map([ [character: string, [includeCharacterAtStart: boolean, includeCharacterAtEnd: boolean]], ... ])
* ```
* @param {Map<string, *[]>} forwardQuoteMap A mapping of quote characters that delimit a sentence.
* Format:
* ```js
* new Map([ [character: string, [otherCharacter: string, includeCharacterAtStart: boolean]], ... ])
* ```
* @param {Map<string, *[]>} backwardQuoteMap A mapping of quote characters that delimit a sentence,
* which is the inverse of forwardQuoteMap.
* Format:
* ```js
* new Map([ [character: string, [otherCharacter: string, includeCharacterAtEnd: boolean]], ... ])
* ```
* @param {import('text-scanner').SentenceTerminatorMap} terminatorMap A mapping of characters that terminate a sentence.
* @param {import('text-scanner').SentenceForwardQuoteMap} forwardQuoteMap A mapping of quote characters that delimit a sentence.
* @param {import('text-scanner').SentenceBackwardQuoteMap} backwardQuoteMap A mapping of quote characters that delimit a sentence, which is the inverse of forwardQuoteMap.
* @returns {{text: string, offset: number}} The sentence and the offset to the original source.
*/
static extractSentence(source, layoutAwareScan, extent, terminateAtNewlines, terminatorMap, forwardQuoteMap, backwardQuoteMap) {
Expand Down
6 changes: 3 additions & 3 deletions ext/js/language/text-scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ export class TextScanner extends EventDispatcher {
this._sentenceScanExtent = 0;
/** @type {boolean} */
this._sentenceTerminateAtNewlines = true;
/** @type {Map<string, [includeCharacterAtStart: boolean, includeCharacterAtEnd: boolean]>} */
/** @type {import('text-scanner').SentenceTerminatorMap} */
this._sentenceTerminatorMap = new Map();
/** @type {Map<string, [character: string, includeCharacterAtStart: boolean]>} */
/** @type {import('text-scanner').SentenceForwardQuoteMap} */
this._sentenceForwardQuoteMap = new Map();
/** @type {Map<string, [character: string, includeCharacterAtEnd: boolean]>} */
/** @type {import('text-scanner').SentenceBackwardQuoteMap} */
this._sentenceBackwardQuoteMap = new Map();
/** @type {import('text-scanner').InputConfig[]} */
this._inputs = [];
Expand Down
6 changes: 6 additions & 0 deletions types/ext/text-scanner.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,9 @@ export type PointerEventType = (
'click' |
'script'
);

export type SentenceTerminatorMap = Map<string, [includeCharacterAtStart: boolean, includeCharacterAtEnd: boolean]>;

export type SentenceForwardQuoteMap = Map<string, [character: string, includeCharacterAtStart: boolean]>;

export type SentenceBackwardQuoteMap = Map<string, [character: string, includeCharacterAtEnd: boolean]>;

0 comments on commit 92124eb

Please sign in to comment.