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

Strips HTML tags from code completion list #3877

Merged

Conversation

emmebi
Copy link
Collaborator

@emmebi emmebi commented Mar 18, 2023

Identify the Bug or Feature request

Fixes #391

Description of the Change

The summary is stripped of HTML tags using a very coarse regular expression which should match a <...> sequence inside a short description. I intentionally left the regular expression simple, as we don't need a real HTML parser here, just something to strip the HTML tags away. We can complicate the expression as needed.

The stripped strings are kept into an hashmap, which is then indexed by the unstripped string. We can't use a static approach, because additional macros or UDFs could be added, and require their own short description stripped.

Possible Drawbacks

The performance loss can be evaluated in terms of one hashmap look-up for each function each time we create the dialog, plus one string replacement for the first time we need to populate the cache. As the number of strings should be small (in the order of 1000) the loss should be small enough to be negligible.

Documentation Notes

N/A

Release Notes

  • removes HTML tags from code completion list

This change is Reviewable

private static final ConcurrentMap<String, String> htmlCache = new ConcurrentHashMap<>();

String remove(String htmlString) {
if (htmlString == null) return null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Our coding style wants {} for one line ifs too. (even if spotless doesn't check it)

@cwisniew cwisniew merged commit a6249a0 into RPTools:develop Apr 1, 2023
4 checks passed
@cwisniew cwisniew added the feature Adding functionality that adds value label Apr 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding functionality that adds value
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean html tags from code completion list
3 participants