Closed am11 closed 8 years ago
Hello. Maybe I can help, but I need more context. I am not familiar with Web Essentials. What do you require? YamlDotNet already provides syntax highlighting. I don't see the point of duplicating that functionality.
@aaubry, thanks for your reply. With WE2013, we can enhance the functionality with editor, like pressing Alt + Enter
for decreasing, Shift + Enter
for increasing and Enter
for no change in indentation on newline.
Also, with Side Waffle, we can register the file extension and the YAML template (http://www.youtube.com/watch?feature=player_detailpage&v=h4VaORKgrOw)
This sounds good. What do you need me to do?
@aaubry, since you have the excellent knowledge of YAML AST, I was hoping if you could help us bringing YamlDotNet library in WE, so to get enhance editor support, bundling YAML files together and shortcuts etc.. WE2013 is currently consuming lots of libraries (ZenCoding, CssSorter and then number of NodeJS packages).
Since YamlDotNet already has a VS extension, it would make more sense to add such functionality to the existing YAML extension. You can add features like special enter key handling using CommandTargets; see Web Essentials for examples.
Other features I would recommend adding include error checking (for invalid YAML syntax), and IntelliSense (for files that have a schema).
Separately, Web Essentials could add a YAML ProjectionBuffer to embed your editor in Jekyll front-matter blocks; this would not require any changes on your end. (currently, this would only be doable for my new Markdown editor; the HTMLX editor is not yet extensible enough to allow this easily for HTML files)
For future features like embedded IntelliSense, WE would need a (MEF-based) API to give your extension the schema for the IntelliSense. Also, please make sure that any future features you add work properly with projection buffers (be aware of the difference between text views and text buffers)
Thanks @SLaks for the directions and elaboration.
@aaubry, those commands will surely improve productivity in writing YAML. I used to work on NetBeans for writing YAML files for ROR projects (via extension) and pressing enter takes you to the next line with current-indentation + two-space indentation
, but no explicit command for go retain or jump to parent (except go to newline's start with Shift+Enter). The markdown (.md) file support in VS via Web Essentials is super cool with those command in YamlDotNet will make the markdown editor superb!
Thanks.
(particularly for Jekyll blog posts)
@aaubry. can we make YamlTab to produce two spaces? Also, atm Enter
, Shift+Enter
goes to the same indentation level in next line, but for every 4 consecutive tab-count, it puts \t
and, as tab indentation is invalid, it highlights these trailing tabs as invalid characters. C#, VB, LESS, CSS, CoffeeScript etc. editors persist tabbing with spaces.
@SLaks, any suggestions? Moreover, can we implement formatting in YAML editor such that; when Ctrl+K, Ctrl+D
key sequence is provided, it formats the document with atleast one rule:
if trailing space count of any line % 2 != 0, insert a space at the beginning of line
given we have IParser
and all.. Currently, this finger dance has no effect in YAML editor (disabled?).
Classifications are just for highlighting; they have nothing to do with tabs or spaces.
It sounds like you should be changing the tab settings in Editor Options. (to make a new sectiom there, you may need to export an old-style EditorFactory). I don't know if its possible to force that.
You can handle the Format Document command (like WE does for SASS) and do whatever you want.
You may also want to implement ISmartIndent.
@SLaks, is there any concept of callback when key is handled by VS? We can decrement two spaces per tab (or \b
followed by two spaces; as if tab will insert \t
)..
Yes; there is a TYPECHAR
command.
However, don't do that; you should simply set the tab settings for your language.
Regarding the tabs, I agree with @SLaks, you just need to select the appropriate indentation settings in Visual Studio. There's no need for extra handling in the editor.
I am a bit lost in this thread because you mention a lot of stuff I know nothing about, such as ProjectionBuffer. I am willing to provide guidance to whoever will be implementing this, but I am unable to dedicate the required time to implement this. I already have a long backlog.
Also, I'd like YamlDotNetEditor to continue to be a standalone add-in. I don't want to be forced to install WebExtensions to edit YAML. Of course I don't mind if YamlDotNetEditor includes an API that WebExtensions uses.
We haven't been talking about making YamlDotNetEditor require Web Essentials (in fact, I can't even think of any reason to do that).
The ProjectionBuffer stuff is on my end; I hope to make Web Essentials embed your editor in front-matter blocks. This doesn't require any code changes in your editor itself; it just needs that your code maintain proper separation between TextBuffers (which contain code) and TextViews (which display one or more buffers).
So far, your code is fine in that regard; if any issues develop, I'll probably submit a pull request.
Thank you for your work here!
The YamlDotNetEditor addin has been moved to its own repository here - https://github.com/aaubry/YamlDotNet.Editor Further discussion, if necessary, should occur there.
Can you help us hooking up your Yaml AST and implementing syntax highlighting in Web Essentials.
Related issue on WE2013: https://github.com/madskristensen/WebEssentials2013/issues/148