Comments (5)
php
from better-align.
hope fix soon
from better-align.
I'm not sure if this is the proper solution, but I think it might work to solve the issues described above. I'm not entirely sure how to write atom extensions or even test this change below, but perhaps @WarWithinMe might be able to use this as a solution and we can get this fixed 😄
Basically we're adding a new else if
statement after https://github.com/WarWithinMe/better-align/blob/master/src/formatter.ts#L201 to check for the cases above.
let char = text.charAt(pos);
let next = text.charAt(pos+1);
let prev = pos > 0 ? text.charAt(pos-1) : "";
...
} else if ( char == "=" && next == "=" ) {
currTokenType = TokenType.Word;
nextSeek = 2;
} else if ( char == "=" && (prev == "=" || prev == "<" || prev == ">") ){
currTokenType = TokenType.Word;
nextSeek = 1;
}
...
For the case where ===
is encountered, it will first trigger the first if
above on when analyzing the first =
in the string and then push to the nextSeek to look at the third =
which then gets marked as an TokenType.Assignment
a few else if
statements later. But if we check check to see if the previous character is =
we'll mark it as a TokenType.Word
and not reach the later else if
statement.
For the case of <=
and >=
, the last logic applies. It reaches our new if
and marks it as a Word
before it gets a chance to reach the assignment check.
from better-align.
I created a pull-request to fix this #41 .
Please @WarWithinMe check and accept it, thanks!
from better-align.
Please, update your plagin for VS Сode with this fix. Thanks lot!
from better-align.
Related Issues (20)
- Unexpected alignment of python multiple declarations HOT 1
- assignments in vhdl := and <= HOT 3
- ?= assignment operator for Makefiles
- Aligning strings ending with backslash in PowerShell
- Better align doesn't work in VSCode in MacOS HOT 3
- Essential Operators <<, >>, |= HOT 1
- add alignment support to @ symbol
- Force-ignore characters when aligning?
- Using with Prettier is changing the alignment of code HOT 2
- Weird align behaviour? HOT 1
- Markdown table align
- Regex Alignments
- How can I auto align formating on save in vscode?
- How to align python comment with #?
- How to align to "<=", when in system verilog
- From the command palette (ctrl + shift + P) How can I define the 'Better Align' shortcut?
- Align properties across objects (table-like)
- better align doesn't work with C code
- Conditional `:`
- How to ignore colon, the other unchanged
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 better-align.