Quickly get answers and code samples from Stack Overflow directly in Atom


#1

Been developing this package for a while now. Let me know if you have any comments or suggestions.

Thanks!


Package
Github

Quickly get answers and code samples from Stack Overflow directly in Atom editor.

Features

  • Insert or copy code samples with the click of a button
  • Easily browse between questions and answers
  • Sort by relevance or votes
  • Access to the number of votes, tags, accepted answer and more

Usage

Toggle the Ask Stack Overlow form using CTRL + ALT + A or by typing Ask Stack in the command bar.

Installation

Package homepage

Install from the command line:

$ apm install ask-stack


#2

Is it possible to make it match the current UI theme while still allowing it to be themed separately?


#3

Maybe. I don’t know if the current theme CSS variables are accessible. Or perhaps if I don’t overwrite the background color it will simply use the current theme color. I’ll look into that.


#4

Yes, the theme variables are accessible if you do:

@import "ui-variables";

#5

This is an ingenious idea! Great work!
I’ll be watching this closely.


#6

Ok good. I’ll try to get it working with a couple different themes see what looks good.


#7

Thanks. Let me know if you have any suggestions.


#8

Love it! I particularly like the embedded question and answer content, and the copy/insert buttons on code items. It’s such a breeze this way!

Like @leedohm mentions, some options for customization would be a neat next step, incl. integration with the currently used UI theme, but also letting users configure a few more parameters for the stackexchange search:

  • Just “Answered” questions: Yes/No
  • pre-populated, but still overwritable, Language field (from currently open / most recently focused editor tab)
  • Option to see more responses embedded / expandable.

Just a few first thoughts, but keep at it man, this is awesome not only for code newbies.

Cheers!


#9

Just “Answered” questions: Yes/No

Good idea. I’ll look at how this can be done.

pre-populated, but still overwritable, Language field (from currently open / most recently focused editor tab)

This is something I’ve been meaning to get working since day 1 but just haven’t found it if it’s possible with the current API. If anyone knows please let me know.

Option to see more responses embedded / expandable.

Not sure I get what you mean. There’s already a link a the bottom to load more questions/answers (5 more on every click).


#10

atom.workspace.getActiveEditor().getGrammar().scopeName should do the trick for you for “currently open”.


#11

Awesome. I’ll try that when I get home tonight.

Edit: Is that documented? The getGrammar() method is documented in the Editor class but I don’t see scopeName in the Grammar class. Where did you find this?


#12

No, properties in general are not currently documented. I found it by poking around in the Console :smile:


#13

I see. Well good job finding this :stuck_out_tongue:


#14

Ah sorry, I suppose I just haven’t seen that one yet. I’ll try it out.


#15

pre-populated, but still overwritable, Language field (from currently open / most recently focused editor tab)

This has been implemented with this commit. However I haven’t tested it a lot yet so I won’t push a new version just now. Probably before the weekend. Meanwhile you can also checkout the code if you want to help testing :slight_smile:

Edit: Better idea. I just pushed a new version (0.0.5) with the “detect language” feature but it is disabled by default. You can go in the settings to enable it and try it out.


#16

Great package idea! Just got one minor suggestion; stick to semantic versioning, which is encouraged by apm

Keep up the good work :shipit:


#17

Ok I have updated the package, but I can’t see any new settings:

Am I missing anything?


#18

The author (@Chris911) has forgotten to provide defaults for all the available configuration values:

In the meantime, you can set the values manually by updating your config.cson file.


#19

Tried restarting Atom? This is what I see:


#20

The default is right there in that file you linked. Look at line 5 autoDetectLanguage: false