Comments (5)
Closing as I think this is now fixed (since 1.2.0) but let me know if you're still having issues!
from rewrap.
Ok a few things going on here.
Firstly just taking Markdown for a moment, if there's something that's specifically not working there could you give me an example? For example, bullet points should already be working as you describe.
* Non elit aliqua ullamco nostrud. Excepteur officia do et officia sunt non voluptate mollit adipisicing dolore ex.
Wraps to:
* Non elit aliqua ullamco nostrud. Excepteur officia do et officia sunt
non voluptate mollit adipisicing dolore ex.
I'm not sure if you're also using them in LaTeX, or another language.
Rewrap also already preserves the indentation of the second line elsewhere (eg multiline comments). So it wouldn't be out of the question to implement it in other places too.
Back to LaTeX: support is something that's been on the radar, but I've just been waiting for someone to request it. However, the extension currently doesn't recognise the language at all, which means it defaults to the Markdown processor, which won't always produce good results for LaTeX. I've now made a quick change in master, so that it recognises it as a source code file (with % for comments).
This will immediately change some behaviour and give some improvements. Eg this example will now work:
\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua excepteur sint occaecat cupidatat non
Wraps to:
\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id
est laborum.
As long as the cursor is on the second line (or the whole thing is selected). This comes because the starting text is now already seen as 2 separate paragraphs, because of the difference in indentation.
The last example, with very messy lines:
* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
do eiusmod tempor incididunt ut labore et dolore magna aliqua excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum, duis aute irure dolor in reprehenderit
in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Again, this should already work in Markdown, so if you're using it somewhere else, maybe we can have it work automatically there too. I'd like to try that before creating extra behaviours depending on what is selected.
from rewrap.
I've just published v1.1.0, which contains the changes for LaTeX described above. Hopefully it should help.
from rewrap.
Thanks for the quick reactions and sorry for the delay from my side. I also think that there was some confusion on my site: I wasn't aware that the wrapping is filetype-dependent (which makes perfect sense), and if I remember correctly, I tried the examples with a plain old text file (.txt
).
Regarding Markdown: wrapping indeed works as expected, also with messy lines.
Regarding LaTeX (using plugin version 1.1.0 and file extension .tex
): the non-messy case works, e.g.
\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum, duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
is wrapped to
\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua
excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum, duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
The messy case, however, doesn't wrap as expected. E.g.
\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum, duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
wraps to
\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua
excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum,
duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
I tried selecting only the second and subsequent lines (and the other way round, to have the cursor on the second line) and also the whole block (including the first line), but the behaviour is always the same.
from rewrap.
Have just published v1.2.0 which contains some more improvements for LaTeX. The messy case will now work here.
It's also now detected as a single paragraph so you only have to have your cursor in the paragraph to wrap the whole thing.
The indent of the 2nd+ lines is determined by the indent of the 2nd line. However if there's only 1 line to begin with, then following lines will have the same indent as that one.
Eg:
\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua excepteur sint occaecat
Wraps to:
\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua excepteur sint occaecat
But
\item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
Wraps to
\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt
I've wondered in the past about adding a "default indent" setting for this case, so if you'd find it very helpful I could add that too.
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.