Codeglance in atom


#1

Hello! For complete happiness in atom I need 2 things: autocompletion and “like jetbrains” codeglance. Autocomplete is slowly but surelly becoming nice. So I would like to improve it with codeglance. I am new to atom api, so I need advice. Is it possible to render dynamic window (custom scale and position) with a part of main textfield of aso custom scale and position? Which api i need to check? Thanks!


#2

The best thing you can do is find an existing package that looks like the one you want. You won’t be able to figure out what you need by just looking at the API.


#3

By this I meant any package with a similar UI so you can steal a bunch of the code.


#4

Sure, but among atom packages there is nothing like code glance. May be minimap. Of cource, I can scan text and “draw” codeglance like minimap, but its painfull, so I am looking for solution, to make a “little dynamic pane” with atom api if its possible.


#5

I’m sure there are a lot of packages that do this. There are probably hundreds in the registry. My brain has shut down for the night but others might suggest packages for you.

BTW, what do you mean by a dynamic pane? Is this a pop-up dialog or pane like the mini-map pane? The mini-map type pane is quite easy to create. You can put any html you want in there. I don’t know if I’d call that “drawing”.


#6

Hmm, so minimap renders itself from html (didn’t look code)… thats probably appropriate for task. Thank you!


#7

From the jetbrains site:

Embeds a code minimap similar to the one found in Sublime into the editor pane. Works with both light and dark themes using your customized colors for syntax highlighting.

So the minimap package should be just what you’re looking for or is there anything I missed about codeglance that differs from ST/Atom minimaps?


#8

Yep, codeglance is not only minimap, but also a a think which shows code in snapped-to-mouse window when mouse is over scrolling field or minimap area.


#9

I’m curious about this feature, is there some video that demonstrates that feature? Maybe I can write a minimap plugin for that too.


#10

I thought this is an interesting feature, and I also wanted to try my hand at writing a minimap plugin. So I went ahead and created minimap-codeglance. Right now it’s just a proof of concept that logs the lines under the cursor to the console, but I’ll build a UI in the near future.


#11

@olmokramer Let me know if you need some advice about minimap plugins


#12

Amazingly couldn’t find any screens or video. But if you install pycharm jetbrains. You’l see that on scroll field there are lines of code errors and if you put mouse over such lines the float miniwindow will show you that part of code.
UPD. This screen shows codeglance


#13

Ok, I worked on it, and published minimap-codeglance. Please let me know what you think!

And @abe, great job on the plugin minimap API! It was a breeze to set this kind of thing up :smile:


#14

Good and usable just right now! I think it should be popular during time.
List of wishes:

  • showing line numbers
  • setting text indentation.
  • float-to-mouse window.

#15

Thanks! :smile: I’m definitely going to implement the line numbers and the float-to-mouse. I don’t really understand what you mean with “setting text indentaion”, though. Could you elaborate?


#16

If window is fullscreen, first characters are little beyond the screen. Little indentation (and/or line numbers) to comportable looking.


#17

Thanks, I think I see what you’re getting at. Good catch. In the meantime, you can put the following in your styles.less:

.minimap-codeglance  atom-text-editor {
  padding: 0 10px;
}

#18

Oh, thats it! Thanks!
Also float window is important because now minimap changes its view on mouse over, because atom layout changes. It’s blinking is uncomportable. If window floating, minimap stays persistent.
UPD.
Modal option solves “blinking”, but cusom size is better than fixed :wink:


#19

@Losiara Thanks for the feedback :slight_smile: I think I’ll have some time tomorrow or the day after that to implement these things. I agree that it’s still a little sluggish, most noticeably in files with a lot of lines, but I think those problems are easily overcome :smile: Cheers!


#20

Ok, I just wanted to work on this tonight. Everything you listed is implemented now. It’s become a pretty cool little thing if I may say so :smile: