GithubHelp home page GithubHelp logo

Comments (8)

ewerybody avatar ewerybody commented on June 13, 2024

I would actually like to have a look into this myself but I have NO idea where to start as I'm not into TS or Electron at all. But that can change :)

I guess everything is already build-in to VS Code? To debug TS? Where would I start setting breakpoints? Can I debug the running VS Code while coding it ... ?!?! 🤔

from ahkpp.

FuPeiJiang avatar FuPeiJiang commented on June 13, 2024

to help understand: since strings are removed, it becomes var := x>y ? 2 :(var purityText in \vscode-autohotkey-plus-plus\src\provider\formattingProvider.ts), and anything that ends with : is considered a hotkey, so it is indented

my git is kinda messed up right now... I'm learning how to use, now I have time
I will try to fix this after

from ahkpp.

ewerybody avatar ewerybody commented on June 13, 2024

hmm. But

var := x>y ? 2 : 3
something("skdfjbv")

remains unchainged!

After all: I think we need some tests for the formatter at best on various bigger libraries and.

from ahkpp.

FuPeiJiang avatar FuPeiJiang commented on June 13, 2024

3 is not a string
I said strings are removed
3 here is a number

from ahkpp.

fade2gray avatar fade2gray commented on June 13, 2024

@ewerybody
Maybe this might help understand. Try formatting this.

;Formatting ignores any string after the colon
;making the ternary operator act like a hotkey.
var := x>y ? 1 : 2 ;<< Integer after tthe : is ok
;identation no
var := x>y ? 1 : ;<< empty value after : causing indentation
;everything indented
;until something
;ends with a : or  : "string" or Return
var := x>y ? 1 : "2" ;<< "string" ignored causing indentation
;everything indented
;until something
;ends with a : or  : "string" or Return
HotKey:
;everything indented
;until something
;ends with a : or  : "string" or Return
Return

from ahkpp.

ewerybody avatar ewerybody commented on June 13, 2024

Ah ok. I didn't get what you mean with "strings removed". Thought you mean quotes removed or something.
"string" ignored is a little more clear. Thanks @fade2gray
But what about the ; why aren't these ignored? See:

;Formatting ignores any string after the colon
;making the ternary operator act like a hotkey.
var := x>y ? 1 : 2 ;<< Integer after tthe : is ok
;identation no
var := x>y ? 1 : ;
;identation no
var := x>y ? 1 : "2" ;
;identation no
HotKey:;
;identation no
Return

from ahkpp.

fade2gray avatar fade2gray commented on June 13, 2024

Because the ternary operator is only affected if it finishes with a string or nothing at all.

var := x>y ? 1 : "2" ; Here, the string is ignored but formatting still sees the semicolon so it is not interpreted as hotkey/label.

from ahkpp.

FuPeiJiang avatar FuPeiJiang commented on June 13, 2024

"string" ignored is a little more clear.

noted

But what about the ; why aren't these ignored? See:

ty for finding this, this isn't supposed to happen, since one ; is a comment too
the reason for this is:
.replace(/;.+/, '') + is one or more
if you use this instead, the empty comment will be ignored, (I like to say removed because it's being replaced with empty string)
.replace(/;.*/, '') * is zero or more

this is in function CodeUtil.purity of \vscode-autohotkey-plus-plus\src\common\codeUtil.ts

but I suspect that changing ONLY this regex won't fix the problem of matching comments properly...
since `; is not a comment

I will try to fix these, after...

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.