Comments (8)
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.
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.
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.
3 is not a string
I said strings are removed
3 here is a number
from ahkpp.
@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.
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.
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.
"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)
- Extension forgot AHK location HOT 4
- "Go to definition" using Ctrl + Click jumps to another file opened in editor / or doesn't jump to definition at all within the same file if the file is very long ~10k lines HOT 1
- Wrong indentation when moving line of code out of if-statement HOT 1
- Wrong indentation: press Enter after condition-block in If-statement
- AHK++ is not activating. HOT 11
- "Run" command thinks a V1 script is V2. HOT 4
- Formatter replaces multiple spaces with a single space inside a string HOT 1
- Wrong indentation on copy-paste HOT 6
- How to format code There is no formatter for 'ahk2' files installed. HOT 2
- No format intelicence or formating or colors HOT 4
- Language Switch problems HOT 2
- format code feature changes the number of spaces in a constant string HOT 1
- Debugger takes keyboard focus from active window HOT 1
- The Open AutoHotkey Help command is failing HOT 2
- allow rename variables HOT 1
- Availability as standalone LSP HOT 2
- Shortcut to comment/decomment selected line HOT 3
- Single-line `Hotkey` in fall-through scenario
- Debug won't start HOT 2
- [v2] Can't the v2 version outline be used? Only v1 has an outline? HOT 1
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 ahkpp.