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

add reference lookup command #78

Merged
merged 1 commit into from
Feb 16, 2023
Merged

add reference lookup command #78

merged 1 commit into from
Feb 16, 2023

Conversation

nathonius
Copy link
Contributor

  • Added a command to insert a verse reference, which works identically to the existing editor suggest lookup (except for the -- before the verse reference)
  • Refactored to share as much code as possible between the existing editor suggest and the new suggest modal

Resolves #11 for me, anyway; technically the conflict still exists this just adds a new way to use the plugin. It only took me one year to finally get around to doing this and less than 24 hours to actually write it.

Let me know what you think.

async getSuggestions(
context: EditorSuggestContext
): Promise<VerseSuggesting[]> {
return getSuggestionsFromQuery(context.query, this.settings);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was refactored out to VerseSuggestor.ts

}

renderSuggestion(suggestion: VerseSuggesting, el: HTMLElement): void {
suggestion.renderSuggestion(el);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the actual rendering of a suggestion to the suggestion itself so it could be shared between this and the modal.

src/main.ts Show resolved Hide resolved
@tim-hub tim-hub self-requested a review February 14, 2023 19:56
Copy link
Owner

@tim-hub tim-hub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good to me, I will have a local run to check.

Thanks so much for your work.

* John12:1-3
* John1:1
*/
const modalReg = /([123])*[A-z]{3,}\d{1,3}\:\d{1,3}(\-\d{1,3})*/;

Check warning

Code scanning / CodeQL

Overly permissive regular expression range

Suspicious character range that is equivalent to \[A-Z\\[\\\\]^_`a-z\].
): Promise<VerseSuggesting[]> {
console.debug("get suggestion for query ", query.toLowerCase());

const bookName = query.match(/[123]*[A-z]{3,}/)?.first();

Check warning

Code scanning / CodeQL

Overly permissive regular expression range

Suspicious character range that is equivalent to \[A-Z\\[\\\\]^_`a-z\].
@tim-hub tim-hub merged commit c003908 into tim-hub:master Feb 16, 2023
@tim-hub
Copy link
Owner

tim-hub commented Feb 16, 2023

I did a bit refactoring after and now it is in :)

Thanks so much

tim-hub added a commit that referenced this pull request Feb 16, 2023
add reference lookup command

#78
tim-hub added a commit that referenced this pull request Feb 16, 2023
@tim-hub
Copy link
Owner

tim-hub commented Feb 17, 2023

I am thinking of instead of using verse lookup as command

maybe extend to bible book chapter verse to be more direct

@tim-hub tim-hub linked an issue Feb 17, 2023 that may be closed by this pull request
@tim-hub
Copy link
Owner

tim-hub commented Feb 21, 2023

@OfficerHalf ?

What do you think of this idea?
#80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Extend the verse lookup command Conflict with icon shortcodes
2 participants