Comments (17)
Thank you, yatki! Good work! π₯ π
from vscode-surround.
@ylc395 hmm. actually auto-indentation is not something that this plugin offers. It only wraps the selected text from its starting point. So if you are choosing empty lines before executing the surround command, indentation can break.
Also using a formatter like prettier, could also help.
from vscode-surround.
The issue is resolved in version 1.2.0. Thanks for reporting the issue.
The release is available on:
Cheers π,
from vscode-surround.
Hey @oheydrew, thank you very much for your message. I'm glad to hear that it's useful for you.
I'm a bit confused because I think extension already should be working as you described. Here, I recorded an example on my pc:
Please let me know if I'm missing something.
Could you please share the steps to reproduce the issue and also share
- vscode version
- your snippet config (copy and paste it as it is)
- surround version
- (if possible) also a screenshot of the final result when you wrap the selection.
Thanks.
from vscode-surround.
Auto Indentation seems not to work on my PC, too. Does this feature depend on any setting or something?
vscode version: 1.38.1
surround version: 1.0.2
from vscode-surround.
Maybe it wouldn't be so hard to implement this π€ If one assumes that the existing code is indented correctly, the indent should be the same amount as the indent on the first line.
E.g. in the following image the indent should be 2 spaces, since there are two spaces before the first character on the first line
What do you think about an auto-indent feature implemented this way @yatki ? Should I try to implement this? π
from vscode-surround.
Hey @Sti2nd thank you very much for your message. Did you also experience the same issue? Because it's not an issue with most people. Vs code is able to preserve the indentation automatically.. Could you please record your screen to show me how it happens? Also are you using tab characters or whitespace for tabs? I actually tested the extension with both settings and it was working fine.
If we can determine the root cause of the problem first, I'd appreciate any contribution π€ππ»
from vscode-surround.
@yatki Here is a video!
indentation_bug.mp4
2 whitespace is the indent in the video. I actually have this code in a Dev container so if you can't reproduce I could share the repo with you π
from vscode-surround.
Thank you very much for your efforts.. Much appreciated. Now i see the problem. So basically when i surround my code blocks i usually only select the text not the whitespaces before the line.. (whitespaces before const in your case). So i never experienced this problem. ππ
Maybe if you have time you can try to come up with a solution.. It might not be as straightforward as you think tho because vscode applies the changes on selected text.. There are modifiers for SELECTED_TEXT variable. Maybe you can look into those.. https://code.visualstudio.com/docs/editor/userdefinedsnippets#_transform-examples
If you don't have time no worries.. I'll look into it this week otherwise. ππ»
from vscode-surround.
I won't have time before the weekend, I think. I will post here if I begin to look into it! π Otherwise you can just go ahead and fix it if you have time before me βοΈ π
from vscode-surround.
I think this bug came back @yatki ? Can you reproduce?
from vscode-surround.
@Sti2nd which version are you using? Could you please share the code that you are trying to surround?
from vscode-surround.
Version 1.2.2.
Here is a video
UserRoutes.ts.-.workspace.Dev.Container_.Node.js.PostgreSQL.-.Visual.Studio.Code.2021-09-16.20-23-32.mp4
from vscode-surround.
@Sti2nd this is very weird. I am not able to reproduce this issue. Are you using tabs or spaces as whitespace?
from vscode-surround.
Using spaces @yatki , but it doesn't make any difference π€·
from vscode-surround.
That is super weird. I wrote an exact copy of your code just to see if there is a weird character or something that prevents it but it works like a charm in mac and windows..
I assume you are using the latest version of vscode right? Did you try it in different files or on different code blocks? What is the encoding of the file?
The only problem I can think of a hidden character is messing up the whitespace. Because the script is trimming all the whitespace until the first non-whitespace char. And puts the surrounding block in that position. If trimming fails, the problem you are having would happen.
So maybe highlighting whitespace chars as "." could help you to identify the problem.
Let me know if this helps.. @Sti2nd
from vscode-surround.
Tried in another project as well since I thought it might be because of the DEV container environment, but got the same result in a "regular" TS project. I will try to make time to test in different environments, but can't promise anything.
I have VS Code 1.62.0 User setup; extension is v1.2.2; input language in Windows is set to English with Norwegian keyboard.
When you try to reproduce you mark the whole line from the beginning of the window, right, and not only the beginning of the text inside the window.
from vscode-surround.
Related Issues (20)
- How do I use $_GET[ HOT 1
- Vscode crash HOT 1
- deneme
- Add surround to formatter category HOT 1
- Setting to turn off new indentation behavior (in 1.2.0+) per-snippet HOT 2
- Not adhering to selected text HOT 2
- Multi selection is no longer supported starting from version 1.2.0 HOT 3
- Remove `multi selection` reference from readme HOT 1
- Extension Setting for Notifications HOT 2
- [Feature Request] Add a way to customize placeholder variables HOT 3
- all language support plan HOT 1
- [Feature Request] Add settings for curly braces on new line
- Snippets not inserted when nothing is selected HOT 7
- Add Browser Support
- Custom snippet list is broken after first surround HOT 2
- Consider switching to another activation event policy HOT 1
- extençao com problema
- need some help HOT 1
- surround w template literal variable working as intended? HOT 1
- Feature request: adding `new Promise` surround
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 vscode-surround.