https://kotlinlang.org logo
#intellij
Title
# intellij
s

sreich

08/18/2022, 6:23 PM
is there a way to add notes or bookmarks on lines of code. I find that i want to take notes of what my current thinking is, for when i step away from debugging. i see i can set a bookmark on a line, and name it with a desciprtion. but there's no way to view that description unless i rename the bookmark again?
c

Casey Brooks

08/18/2022, 6:30 PM
Is there a reason why you can’t write comments in the code?
Alternatively, I like to use Scratch Files for writing stuff that I don’t want checked into the repo (test account credentials, for example)
s

sreich

08/18/2022, 6:31 PM
well, that's kinda nasty because autosave is forced on, and i'd have to remember/keep track of it getting added in my history it would be more like if you were to save breakpoints to code. silly, right? or i guess if breakpoints would give you nameability
i could give those a shot, i'm surprised IDEs don't have better note taking abilities tbh. you would think code would operate more like say...a Word document, where you've got notations you can add on in spots, that aren't a part of the doc itself
with all the mindmap hype you'd think that would make sense
or, i do
c

Casey Brooks

08/18/2022, 6:32 PM
Code comments are there to help developers understand the thought process behind the code. If they help you remember what’s going on, it will help other developers as well, which makes me think it would be wise to keep the comments in the code.
s

sreich

08/18/2022, 6:33 PM
that does nothing for you when you're deep inside of a library you don't own, trying to wrap your head around the functions and breakpoints, to see why it isn't setting a certain value. And then you get a phone call, and then you just forgot all of that context. I'll use bookmarks and name them. i bet this is something IDEs will get better at in the years to come, if there isn't a thing like this already
c

Casey Brooks

08/18/2022, 6:34 PM
That’s a fair point. For that case, you could get in the habit of not committing everything in the local index (
git add -A
), but using a git GUI to review your changes and add what you want to commit line-by-line, so that you’re only actually committing the code changes you want and not the comments
Though I actually feel like I’ve seen an IntelliJ plugin that did let you “annotate” your code without writing to the source files themselves. I can’t remember exactly, but I think I saw it posted somewhere in this Slack team…
s

sreich

08/18/2022, 6:37 PM
well, i don't think that case even works for decompiled code, i think the editor is read only there. so you'd be SOL 😄
g

Gabriel Pomin

08/18/2022, 6:50 PM
Did you checked the official documentation about bookmarks? There is some options to list, see or group bookmarks you previously added
5 Views