question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for multiple comment marker types

See original GitHub issue

At the moment the action just accepts one comment marker, such as #.

This is fine for single-language projects, but where you have multiple languages you may need to use comments with a different syntax. For example, you might have a Python app that also has some CSS files /* with comments like this */.

One option would be to allow multiple markers in the config, but that could get a bit unwieldy, and you may not always know in advance.

As the action already performs a language lookup when processing each file in the diff, it may be good to use that to determine the comment syntax for the file in question. How we do that, without hardcoding everything (a huge and perhaps impractical task), I’m not sure at the moment.

A workaround at the moment is to set up the action to run multiple times, once for each comment marker type. Obviously this is not the most efficient solution, though.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
alstrcommented, Mar 17, 2021

I have a completely rewritten version of the action almost ready. It processes comments dynamically, using the dictionary method mentioned previously. Will have it available for trying out soon.

3reactions
alstrcommented, Mar 2, 2021

for now, I’d be very happy to specify all the types I’m expecting, maybe just by extending the confg from:

LABEL: "# TODO"

to

LABELS:
 - "# TODO"
 - "// TODO"

Full file-type detection seems overkill to me, given there are about 5 common comment styles 😆

I have been thinking about that. I’m part way through developing a method that works similar to how @ChocolateLoverRaj mentioned, but I might see about this.

The action already looks up the file type for Markdown styling, so I’m planning to use that to check the comment syntax. But yeah, there aren’t too many different formats, so hopefully that will make things more manageable.

I’ll see how testing goes, but hopefully will have something soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Modern comments in PowerPoint
You can type your new comment in the comments pane at the right and select Post (or press CTRL+Enter on Windows, or CMND+Enter...
Read more >
How do I create multiline comments in Python?
Use arrow keys to select all the lines to be commented. Press Shift+I. Press # (or Shift+3). Press Esc. Share.
Read more >
Edit and move markers in Final Cut Pro
In Final Cut Pro, edit marker information or change the type of marker. Move and copy makers, and navigate between markers.
Read more >
Comments - CSS: Cascading Style Sheets - MDN Web Docs
A CSS comment is used to add explanatory notes to the code or to prevent the browser from interpreting specific parts of the...
Read more >
Comments in R
There are generally three types of comments supported by languages, ... Note: R doesn't support Multi-line and Documentation comments.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found