Comments (3)
Ok it's been a few months, but this is finally in version 1.4. I did go for Markdown parsing in the end (CommonMark spec); it's even used as standard in some newer languages like Dart and Elm.
A couple of details: a blank line between the preceding paragraph and the first bullet point is optional. Also as mentioned above, the bullet markers must be indented less than 4 spaces.
from rewrap.
It's nice to hear the addon gets a lot of use :)
Yeah lists are something I definitely want to support, and have been thinking about doing for a long time; it's just a question of how, and working out the details.
Things to consider for example are: which characters to allow as bullets (- * + #?, do you also allow numbers?). Also how do you distinguish a bullet paragraph from one of those characters that just happens to be at the start of a line in the middle of a sentence? Do you require a blank line separating them (as in your examples) or do you try something more clever?
Something I've wondered about, though just not yet explored in full, is processing all comment text as Markdown, using the existing parser. It seems maybe a little overkill, but you get a lot for free, including all those rules. And it's probably more sensible to use an existing spec than making up your own. It would require a little extra code to deal with things like @tags in js/javadoc and xml tags in C#, but it would also replace some existing code and give some new features like code blocks between ```
lines (used in PureScript doc comments.)
Thinking about it now I think I'll try this route and see how it turns out.
(Just a note: in your examples the list items are indented 4 spaces before the -
character. Currently Rewrap treats all lines indented 2 spaces or more (or 1 tab) as a code sample. If markdown was used would become 4 spaces (or it could be bumped up to 4 anyway), but the point is it'll only be possible to have list items indented 1, 2 or 3 spaces.)
from rewrap.
I'd be cautious about full Markdown parsing. I like Markdown and use it in many places day-to-day, but it's actually surprisingly complicated and ambiguous, and feels like overkill for code comments. My preference is that an addon like this should be as un-opinionated as possible. I work on other people's code quite a lot, and have to cope sympathetically with all sorts of outlandish coding conventions as I find them. I'm not always in a position to impose anything more than minimal sanity, and I think you're very close to the minimal surface area here: wrapping, code samples and bullet lists just about covers it.
from rewrap.
Related Issues (20)
- [Feature Request] Support `.razor` files
- Feature request: support javadoc in Ruby comments
- OSX: '.' inserted when adding two spaces after a word HOT 1
- HTML comments in Markdown with no content left of the comment
- Invoking Rewrap from outside of VS Code: to run as a linter? HOT 1
- Running tests & ./do
- Installing from source (to VS Code)
- CONTRIBUTING.md
- Feature request: Clicking on the auto-wrap icon should toggle auto-wrap mode
- Does not rewrap a comment?
- can't get the extension to do anything on a rust file... HOT 3
- Soft rewrap
- Valid comments with unusual comment markers are not wrapped correctly.
- Feature request HOT 1
- Hyphen- and indentation-aware wrapping in YAML
- Request: set line length to 100 for rust doc comments HOT 1
- Bullets / lists are not respected in comments that use `///` HOT 2
- This extension blocked typing "@" on Latin American keyboard layout
- PHPDoc tags sometimes break
- Alt + Q Default Shortcut Not Working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rewrap.