GithubHelp home page GithubHelp logo

Comments (10)

mark-wiemer avatar mark-wiemer commented on June 6, 2024

Hi, sorry for the late reply. Are you able to provide some sort of pseudocode JSON output of what you're expecting? Do you want me to expose something like { row: 2, col: 4 } when you press Ctrl + C?

Looking at your SO question, it looks like you want to copy both the index of the starting position and the selected text in one "Copy" command, is that right? If so, this sounds like a very niche use case, and I can't say I'd spend much time working on it. The purpose of this tool is to help developers write AHK code, and I don't see how that would help. You're more than welcome to help me understand how this is useful!

from ahkpp.

fade2gray avatar fade2gray commented on June 6, 2024

Hi, my use case was to produce an AHK script that could simplify the creation of folding block comments.

As it is, VSC requires lines of text within the block comment to be indented for it to fold. The need for indentation can be eliminated with the combined use of the folding region tags ;region ;endregion ; the tag combination can be achieved by removing the circumflex anchors from lines 34 & 35 of the ahk.configuration.json file.

For the script to function correctly, it would need to ensure the selected block of text starts at column 0 and finishes at the end of a line and would otherwise issue an alert when launched.

Perhaps this concept could be encoded within the extension, possibly being called from the editor's context menu?

FoldingBlockComment

from ahkpp.

mark-wiemer avatar mark-wiemer commented on June 6, 2024

I saw your commit to cweijan's repo, and I appreciate the contribution! I plan to review the changes he's made and merge them into mine, including the removal of the anchors that you mentioned. Folding block comments are definitely important to me, and I think I can do even better than the implementation you've shown in your screenshot. Instead of:

/* ;region
line one
line two
*/ ;endregion

How about:

/*
line one
line two
*/

And the above comment is foldable?

from ahkpp.

FuPeiJiang avatar FuPeiJiang commented on June 6, 2024

what extension are you using to make block comments foldable ?
currently I'm using this (toggle line comments):
https://stackoverflow.com/questions/60334430/shortcut-to-toggle-commented-and-uncommented-code-at-the-same-time#60366506

from ahkpp.

fade2gray avatar fade2gray commented on June 6, 2024

@mark-wiemer

I saw your commit to cweijan's repo, and I appreciate the contribution!

I made a further commit here. I edited the RegEx's like so...

"start": "^(\\/\\*)?\\s*\\;\\s*region\\b",
"end": "^(\\*\\/)?\\s*\\;\\s*endregion\\b"

How about:

/*
line one
line two
*/

And the above comment is foldable?

Yes, just like in Notepad++ and similar editors.

This is a folding 'helper' script I devised.

from ahkpp.

FuPeiJiang avatar FuPeiJiang commented on June 6, 2024

@fade2gray I answered your question, but on stack overflow
https://stackoverflow.com/questions/64791832/found-somevscode-how-can-i-determine-the-cursors-column-position-within-an-edi#65316198

from ahkpp.

fade2gray avatar fade2gray commented on June 6, 2024

@FuPeiJiang Yes, thanks for that. I didn't reply there because it says not to leave comments just to say "thanks". Now, with my extremely limited experience with creating extensions, I need to try and implement your code suggestion.

Thanks again. 👍

from ahkpp.

FuPeiJiang avatar FuPeiJiang commented on June 6, 2024

I think you already solved it using ahk ? did you ?

https://code.visualstudio.com/api/get-started/your-first-extension
yo code
I choose javascript extension because it is faster than typescript to test
on the left, in debug, click the green button
image

image
and then
ctrl+shift+p to run a command, the command name defaults to "Hello World"

idk yet how to edit file using vscode, how to copy to clipboard

from ahkpp.

FuPeiJiang avatar FuPeiJiang commented on June 6, 2024

using ahk, if you want to block comment lines without selecting the full line, (without selecting start of line, without selecting end of line)

f1::
sleep, 50
mass:=getClip()
send, +{home}
left:=getClip()
send, +{end}
right:=getClip()
finalstr:=";region `r`n" left mass right "`r`n;endregion"
clipboard:=finalstr

send, ^v

arr:=StrSplit(finalstr,"`n", "`r")
loop % arr.Length() - 1 {
    send, {up}
}
send, {home}
loop 8
send,{right}
return
; Reload

getClip()
{
    clipboard:=""
    Send, {ctrl down}x{ctrl up}
    sleep, 50
return clipboard
}

from ahkpp.

mark-wiemer avatar mark-wiemer commented on June 6, 2024

Closed by #27

from ahkpp.

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.