Comments (7)
In this particular case, which uses the ||
operator, I could hack around it (such a hack is already in place for TypeScript), but the bug would still appear in foo < bar | baz < xyzzy
. I'm currently opening a core issue for a change that would help, but that's not a short-term solution (or a guaranteed solution at all).
I might come up with a clean solution, and if that fails I'll probably implement a dirty one, but I'd use parens there in the meantime.
from babel-sublime.
Should be fixed in v11.1.1. It's the hacky fix, not a clean one, but it should do the right thing in most cases and it shouldn't make anything worse.
from babel-sublime.
Can you paste an example as text?
from babel-sublime.
Can you paste an example as text?
sure, I will paste the head of the function together with the scoped validation function where code starts to break the highlight.
Starts here:
(checkVazaoFimEscala < checkVazaoMaximo || (checkVazaoMaximo < checkVazaoNormal) || (checkVazaoNormal < checkVazaoMinimo))
Strange but this same code does not break the highlight inside a functional react component.
const calculate1 = async (req, res) => {
// Parametros de sessao
...
// Validacoes nos valores recebidos
const _validateData = ( ... some params ... ) => {
const limitsValues = enumData.validateLimitsValues;
const errorStack = [];
const decimalsAfter = 6;
...
_limitsCheck(
errorStack,
_valorTemperaturaAfterCooler,
limitsValues.temperatura[0],
limitsValues.temperatura[1],
`Umidade relativa: temperatura (aftercooler ou outro) deve estar entre ${functions.formatNumberToString(limitsValues.temperatura[0])} ${temperaturaUnidadePadrao} e ${functions.formatNumberToString(limitsValues.temperatura[1])} ${temperaturaUnidadePadrao} (${functions.formatNumberToString(_valorTemperaturaAfterCooler)} ${temperaturaUnidadePadrao})`
);
// Valor viscosidade dinamica
_limitsCheck(
errorStack,
_valorViscosidadeDinamica,
limitsValues.viscosidadeDinamica[0],
limitsValues.viscosidadeDinamica[1],
`Viscosidade dinâmica: valor deve estar entre ${functions.formatNumberToString(limitsValues.viscosidadeDinamica[0])} e ${functions.formatNumberToString(limitsValues.viscosidadeDinamica[1])} (${functions.formatNumberToString(_valorViscosidadeDinamica)})`
);
// -------------------------------
// Checagem vazao (minimo e maximo)
if (_valorVazaoMinimo !== '' || _valorVazaoNormal !== '' || _valorVazaoMaximo !== '' || _valorVazaoFimEscala !== '') {
const checkVazaoMinimo = (_valorVazaoMinimo === '' || _valorVazaoMinimo === 0 ? (_valorVazaoNormal || 0) : _valorVazaoMinimo);
const checkVazaoNormal = (_valorVazaoNormal === '' ? 0 : _valorVazaoNormal); // Vazao normal sempre presente
const checkVazaoMaximo = (_valorVazaoMaximo === '' || _valorVazaoMaximo === 0 ? (_valorVazaoFimEscala || _valorVazaoNormal || 0) : _valorVazaoMaximo);
const checkVazaoFimEscala = (_valorVazaoFimEscala === '' ? (_valorVazaoMaximo || _valorVazaoNormal || 0) : _valorVazaoFimEscala);
if (checkVazaoFimEscala < checkVazaoMaximo || (checkVazaoMaximo < checkVazaoNormal) || (checkVazaoNormal < checkVazaoMinimo)) {
errorStack.push('Vazão: valor de fim de escala deve ser maior ou igual ao valor máximo, que deve ser maior ou igual ao valor normal, que deve ser maior ou igual ao valor mínimo (caso exista)');
}
}
// -------------------------------
// Checagem pressao diferencial (minimo e maximo)
if (_valorPressaoDiferencialNormal !== '' || _valorPressaoDiferencialFimEscala !== '') {
const checkPressaoDiferencialNormal = (_valorPressaoDiferencialNormal === '' ? (_valorPressaoDiferencialFimEscala || 0) : _valorPressaoDiferencialNormal);
const checkPressaoDiferencialFimEscala = (_valorPressaoDiferencialFimEscala === '' ? (_valorPressaoDiferencialNormal || 0) : _valorPressaoDiferencialFimEscala);
if (checkPressaoDiferencialFimEscala < checkPressaoDiferencialNormal) {
errorStack.push('Pressão diferencial: valor de fim de escala deve ser maior ou igual ao valor normal (caso exista)');
}
}
// -------------------------------
...
from babel-sublime.
Looks like the problem is that the <
in checkVazaoFimEscala <
is being parsed as the beginning of function type arguments. This is almost certainly a bug in the Flow extension. It looks like it's pretty hard to trigger — you need something like foo < bar < baz
, or foo < bar | baz < xyzzy
.
I'll take a look. There may be a similar bug in the core TypeScript definition as well.
from babel-sublime.
wow looks bigger than i thought... if you need help with some other test let me know ok. Thanks
from babel-sublime.
Although it is not a clean solution, it is a welcome help! Thank's
from babel-sublime.
Related Issues (20)
- Babel issue HOT 1
- Inline comments breaking if comment begins with @ symbol HOT 5
- Version 11 broke syntax highlighting. HOT 15
- Object keys highlighting slightly incorrect in recent release HOT 5
- Question on how to short-circuit on ``` for fenced code blocks in Markdown HOT 5
- Sublime 4 Crashing HOT 4
- Possible highlighting error using a nested ternary HOT 3
- Error loading syntax file: 'Packages/Babel/JavaScript (Babel).sublime-syntax' HOT 18
- ST4 Autocomplete does not consider state variables defined in a map HOT 1
- Missing Babel option in syntax selector. HOT 2
- Highlighting of `filter` in `styled-components` seems to break— HOT 3
- css Styled Component helper utility improperly highlighted HOT 3
- Functions with parameters on multiple lines are not highlighted properly. HOT 1
- JS #myPrivateClassMethod() breaks syntax highlighting HOT 6
- Object keys are now red instead of intended yellow on Monokai HOT 2
- Sublime 4149 generates "Error loading syntax file[...]: no such target" pop-up for "JavaScript (Babel)" HOT 3
- Interface in extends class is not well Colored HOT 4
- Object literal property has incorrect color in Sublime 4169
- support html`<b>babel</b>` html syntax in templates 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 babel-sublime.