Skip to content

fix: Better dataview space & cursor in date Auto-Suggest #3025

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

Merged
merged 1 commit into from
Aug 12, 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
9 changes: 1 addition & 8 deletions src/Suggestor/Suggestor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ function addDatesSuggestions(
const dateRegex = new RegExp(`(${datePrefixRegex})\\s*([0-9a-zA-Z ]*)`, 'ug');
const dateMatch = matchIfCursorInRegex(dateRegex, parameters);
if (dateMatch && dateMatch.length >= 2) {
const datePrefix = dateMatch[1];
const dateString = dateMatch[2];
if (dateString.length < parameters.settings.autoSuggestMinMatch) {
return [];
Expand All @@ -333,13 +332,7 @@ function addDatesSuggestions(
// Seems like the text that the user typed can be parsed as a valid date.
// Present its completed form as a 1st suggestion
const absoluteDate = possibleDate.format(TaskRegularExpressions.dateFormat);
const { displayText, appendText } = defaultExtractor(datePrefix, absoluteDate);
results.push({
displayText: displayText,
appendText: `${appendText} `,
insertAt: dateMatch.index,
insertSkip: dateMatch[0].length,
});
constructSuggestions(parameters, dateMatch, [absoluteDate], defaultExtractor, results);
}

const genericMatches = filterGenericSuggestions(genericSuggestions, dateString, maxGenericSuggestions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ For this markdown line:

The first suggestion is:
{
"suggestionType": "match",
"displayText": "2022-10-27",
"appendText": "due:: 2022-10-27 ",
"appendText": "due:: 2022-10-27] ",
"insertAt": 16,
"insertSkip": 12
}
Expand All @@ -31,8 +32,9 @@ For this markdown line:

The first suggestion is:
{
"suggestionType": "match",
"displayText": "2023-07-11",
"appendText": "due:: 2023-07-11 ",
"appendText": "due:: 2023-07-11] ",
"insertAt": 16,
"insertSkip": 12
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ For this markdown line:

The first suggestion is:
{
"suggestionType": "match",
"displayText": "2022-10-27",
"appendText": "📅 2022-10-27 ",
"insertAt": 16,
Expand All @@ -31,6 +32,7 @@ For this markdown line:

The first suggestion is:
{
"suggestionType": "match",
"displayText": "2023-07-11",
"appendText": "📅 2023-07-11 ",
"insertAt": 16,
Expand Down