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

Replace commands by certain text #43

Closed
tobiasdiez opened this issue May 29, 2020 · 6 comments
Closed

Replace commands by certain text #43

tobiasdiez opened this issue May 29, 2020 · 6 comments
Assignees
Labels
1-feature-request ✨ Issue type: Request for a desirable, nice-to-have feature 3-fixed Issue resolution: Issue has been fixed on the develop branch
Milestone

Comments

@tobiasdiez
Copy link

Is your feature request related to a problem? Please describe.
Some commands produce text, for example \Latex or my custom command \ie which expands to i.e.. In these cases, it would be nice to specify the replacement text to allow ltex to pick up the correct sentence structure.

Describe the solution you'd like
Extend the dummy replacement map to allow to specify the replacement. For example:

ltex.commands.dummy = {
    "\\cite{}", // no explicit dummy text
    "\ie" : "i.e." // explicit dummy text
}

Describe alternatives you've considered
Use normal dummy replacement. This works for example for \LaTeX but not for commands that don't produce substantives.

@tobiasdiez tobiasdiez added the 1-feature-request ✨ Issue type: Request for a desirable, nice-to-have feature label May 29, 2020
@valentjn valentjn added this to the 5.1.0 milestone May 29, 2020
@valentjn
Copy link
Owner

valentjn commented May 30, 2020

@tobiasdiez Thanks for the feature request. Could you please give a real-life example/sentence in which replacing your command with a dummy results in a false positive/negative diagnostic?

It's true that this won't work for verbs, but I'm curious where the need to have this actually comes up. Both "i.e." and "\cite" work with dummies (at least for my citation style).

(Edit: One example I already came across is a noun that starts with a vowel, but I'm not sure if that use case is so common that it would justify the introduction of a new setting.)

@valentjn valentjn removed this from the 5.1.0 milestone May 30, 2020
@valentjn valentjn added the 2-needs-info Issue status: We need more information (usually) from the submitter before continuing label May 30, 2020
@tobiasdiez
Copy link
Author

One example where this comes up is singular vs plural.
For example, languagetools complains about The dummies barks loudly. but not about The dummy barks loudly.
Thus replacing textcites by "dummy" leads to no error in ̀ The \textcites{AbbatiCirelliEtAl1986,AbbatiCirelliEtAl1989} barks loudly.` although it should, as textcites is always producing a list of references.

Concerning the i.e.: Using the definition \ie = i.e., there is a comma missing after "\ie" in the sentence This is a test, \ie an experiment. See https://community.languagetool.org/rule/show/IE_NO_COMMA?lang=en&subId=1

(In general, I agree, it appears that a custom dummy replacement is only necessary in rare cases.)

@valentjn
Copy link
Owner

I don't get a diagnostic for This is a test, i.e. an experiment. either. So the mechanism seems to be working; replacing it would make no difference. Directly using \ie would currently result in \ie being omitted from the checked text (since it's an unknown command) and also produce no diagnostics. Am I missing something?

If it's only about plural citations, that's something that could be fixed specifically for those commands like \textcites by changing the dummy. I don't think an extra setting would be necessary if there's no more use cases.

@tobiasdiez
Copy link
Author

I think the above i.e. rule is only available in 5.0-snapshot, thus not yet released.

Otherwise the singular vs plural issue is probably the most relevant one. Adding a new configuration might be the most flexible solution (to support custom commands like \dog vs \dogs) but is perhaps also a bit of an overkill. I let you decide ;-)

valentjn added a commit to valentjn/ltex-ls that referenced this issue May 31, 2020
@valentjn valentjn added 3-fixed Issue resolution: Issue has been fixed on the develop branch and removed 2-needs-info Issue status: We need more information (usually) from the submitter before continuing labels May 31, 2020
@valentjn valentjn self-assigned this May 31, 2020
@valentjn valentjn added this to the 5.0.0 milestone May 31, 2020
@tobiasdiez
Copy link
Author

Thanks for the quick fix once again!

@valentjn
Copy link
Owner

valentjn commented Jun 1, 2020

@tobiasdiez You're welcome. Fix released in 5.0.0.

me-johnomar added a commit to me-johnomar/ltex-ls that referenced this issue Jan 31, 2024
me-johnomar added a commit to me-johnomar/ltex-ls that referenced this issue Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-feature-request ✨ Issue type: Request for a desirable, nice-to-have feature 3-fixed Issue resolution: Issue has been fixed on the develop branch
Projects
None yet
Development

No branches or pull requests

2 participants