chore: more sane line wraps in prettier

This commit is contained in:
Daniel Bauer
2024-12-14 11:36:25 +01:00
parent 1d2a860df2
commit a1245356ad
6 changed files with 60 additions and 263 deletions

View File

@@ -35,10 +35,7 @@ const filledRegex = new RegExp(
* and start and end are the cursor positions of the start and end of the field.
* If the user is not inside a field, it returns null.
*/
export function getTriggerText(
line: string,
cursorPos: number,
): [string, number, number] | null {
export function getTriggerText(line: string, cursorPos: number): [string, number, number] | null {
let match = getTriggerTextFromRegex(line, cursorPos, filledRegex);
if (match !== null) {
return match;
@@ -53,11 +50,7 @@ export function getTriggerText(
* start is the position of the start of the match, and end is the position of the end of the match.
* Otherwise, returns null.
*/
function getTriggerTextFromRegex(
line: string,
cursorPos: number,
regex: RegExp,
): [string, number, number] | null {
function getTriggerTextFromRegex(line: string, cursorPos: number, regex: RegExp): [string, number, number] | null {
let matches = Array.from(line.matchAll(regex));
for (const match of matches) {
console.warn(match);