Giter Club home page Giter Club logo

Comments (17)

Sti2nd avatar Sti2nd commented on August 22, 2024 4

Thank you, yatki! Good work! πŸ₯‡ πŸ‘

from vscode-surround.

yatki avatar yatki commented on August 22, 2024 2

@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.

yatki avatar yatki commented on August 22, 2024 2

The issue is resolved in version 1.2.0. Thanks for reporting the issue.

The release is available on:

Cheers πŸ––,

from vscode-surround.

yatki avatar yatki commented on August 22, 2024

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:

saq8y-wf7hw

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.

ylc395 avatar ylc395 commented on August 22, 2024

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

image

from vscode-surround.

Sti2nd avatar Sti2nd commented on August 22, 2024

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
image

What do you think about an auto-indent feature implemented this way @yatki ? Should I try to implement this? 😊

from vscode-surround.

yatki avatar yatki commented on August 22, 2024

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.

Sti2nd avatar Sti2nd commented on August 22, 2024

@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.

yatki avatar yatki commented on August 22, 2024

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.

Sti2nd avatar Sti2nd commented on August 22, 2024

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.

Sti2nd avatar Sti2nd commented on August 22, 2024

I think this bug came back @yatki ? Can you reproduce?

from vscode-surround.

yatki avatar yatki commented on August 22, 2024

@Sti2nd which version are you using? Could you please share the code that you are trying to surround?

from vscode-surround.

Sti2nd avatar Sti2nd commented on August 22, 2024

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.

yatki avatar yatki commented on August 22, 2024

@Sti2nd this is very weird. I am not able to reproduce this issue. Are you using tabs or spaces as whitespace?

from vscode-surround.

Sti2nd avatar Sti2nd commented on August 22, 2024

Using spaces @yatki , but it doesn't make any difference 🀷

from vscode-surround.

yatki avatar yatki commented on August 22, 2024

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.

Sti2nd avatar Sti2nd commented on August 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.