den
den copied to clipboard
Integrate into dart editor pubspec editor
To do all the following while preserving the pubspec's formatting:
- create pubspec with nice defaults
- update pubspec
- install / uninstall dependencies
- show outdated status of / update dependencies
- bump version
Should probably use #5, rather the the command line API.
Hey @devoncarew you have a lot of editor knowledge, and you integrated the stagehand CLI. Do you have any thoughts on how this could be achieved? Looks like right now it's all Java based, so seems like CLI would be the only option? Any pointers or help would be much appreciated!
Yeah, stagehand would be a similar scenario. For background, stagehand is meant to be driven in one of three different ways:
- via a Dart API (used by dart clients, like CDE)
- via a command line (by users directly)
- driven by tools (by the command line interface, with some hidden options for some commands)
The Java code in the Editor would need to use that third option (or just the 2nd, if no specific machine parsing / commands were required). This would also be useful to clients like Sublime (written in Python), and IntelliJ.
If you wanted to use the Dart API, you'd need to add support to den into the analysis server. The clients would all need to add UI to drive den
, they'd just be issuing commands to the analysis server rather than to the den command-line tool. So, no reduced work on their part.
@keertip wrote the Editor's pubspec file editor. Some of the integration would be pretty simple, some would be pretty involved. Higher value commands with simpler integrations would be the place to start :)
Agree with the points made by @devoncarew . It would be great if analysis server had den support! Then the editor would not have to install yet another tool. Adding ui to the pubspec editor is fairly simple, we just need to make sure the commands added do provide needed/missing functionality in the editor.
Thanks @devoncarew and @keertip!
@keertip I think the most bang for buck integration to start with would be running den spec --force
when someone creates a pubspec. Then when the pubspec file editor appears, the fields would be pre-populated with useful defaults based on their git info etc. There would be no new UI needed for this, just an initialization step. Would you be able to point me to where in the code that initialization step would occur? I assume the pubspec editor would just need to call an API to get the initial yaml and it could initialize its fields from that? That could easily be added as e.g. den spec --dry-run
whose stdout would represent the initial yaml. Adding it to the analysis server would be much more difficult for me, especially since the source is not yet on github. But I will look into it if you don't think calling the CLI is an option. What do you think?
I am hoping that den fetch
and den pull
will be available through the analysis_server via the linter. I'm imagining this and other "pubspec lints" showing up as warning indicators within the pubspec editor on the associated elements (the individual dependencies in this case). Then the "quick fixes" (in this case to update to the latest dependency constraint) could be exposed via a context menu, or the dependency detail pane.
@seaneagan Take a look at http://bit.ly/181QmFN. The NewFileGenerator
is where the editor gets the contents for a new pubspec file.
+1 to pub lints!
While we're on the topic of integration, we should think about IDEA/Webstorm as well. I did the stagehand integration (cribbing off Devon's editor bits to be sure) and would be happy to help shore that up.
Filed an issue to move analysis_server to its own github repo:
http://github.com/22566
in which case I would be happy to add den functionality to it!