WebStorm erroring for what appears to be no reason - webstorm

I am not sure what is going on here. I have a brand new template that someone wrote and I plug it into my editor and get these lovely red squiggly lines. I cannot see any syntax errors so I'm thinking its the editor.
The first thing I see is on the import statement. Why is there a red squiggly there? It is telling me statement expected but that is a simple import statement!
There is yet another after the const serializers. I will likely miss an actual error if these stay on here. I have tried changing the language and it is telling me that it knows its a Vue Component via the V symbol on the file in the Project tab.
I'm not sure what to do here.

Wow, I took a break and came back. Tried to load the component in Vue and it fails with the error.
unexpected character ' '
So it was a damn space! There were a few spaces, maybe it came from the fact that I copied the code?

I'd suggest trying the Zero Width Characters locator plugin - it helps to visualize hidden control characters that might break the syntax highlighting and code execution

Related

How to prevent Prettier from moving comments to new line

I have a typescript project formatted with prettier. My issue is when I save code like this:
const thing = await call({ // comment
a: 1
});
Prettier moves the comment to a new line which is not what I want.
const thing = await call({
// comment
a: 1
});
How do I prevent this from happening while retaining all other format settings?
EDIT: I do not want to use another formatter or // prettier-ignore. I need this done from the config file .prettierrc.json
This is a known issue with Prettier. If you're looking for the corresponding bug/feature request, it's here: https://github.com/prettier/prettier/issues/807
I'm pretty sure there is no way to configure this in .prettierrc, as prettier is opinionated. Though this kind of moving of comments to new line only happens when it appears beside opening brackets. If it really annoys you, you could change to a different linter, such as eslint, which to my knowledge does not do the above.
In my experience, you can specify certain areas of your code for prettier to ignore in the .prettierignore which uses the same syntax as a .gitignore. You can also ignore specific comments as this section of their documentation.

Clear font.ttf from unused glyphs

For example I want to use this .ttf font file:
https://www.onlinewebfonts.com/download/3b2646a48566403a55f62ceddbecbe18
It contains 29,064 glyphs.
I want to leave in it only the letters I use.
A short example: どこでもタップしてプレイ
So, from 29,064 it will be only 12 characters left. In my actual situation if will be around 300 glyphs.
Basically, I want to dramatically decrease it's file-size by removing unused glyphs
Is there a way to implement this by some script? I'm on macOS.
Or some app can do this and how exactly? Is there a real life example?
upd: answer from this question not working, throwing errors:
./subset.pl --chars="どこでもタップしてプレイ" /Users/User/Desktop/1.ttf /Users/User/Desktop/2.ttf
Wide character in subroutine entry at Font/Subsetter.pm line 1496.
In that question there are recommendation of use fixed this bug repo: https://github.com/fnp/librarian/blob/master/librarian/font-optimizer/subset.pl
And with it executing same command gives another errors:
Uses unhandled table 'BASE'
Uses forbidden table 'CFF '
As font file I used that from first link, just renamed it to 1.ttf

Possible bug in Blade templating system with html special characters

I'm not necessarily sure about this but it seems there's something strange going on with umlauts, accented characters and such on Blade templates with Laravel 5.1.
I was banging my head on the wall with a string that ended in an ä-letter which I really, really couldn't get decoded with html_entity_decode no matter what I tried.
Here's what I had in my Blade template file as I was going mad:
{{ html_entity_decode('just-another-string-ä') }}
Now, when I render the template in a browser window I obviously get:
just-another-string-ä
But in the source I have the following:
just-another-string-äauml;
Which in my understanding does not stand for the string that I had given in the blade template.
...several minutes pass by...
After a while I changed the string to:
just-another-string-ä-test
And as a source-code result I get:
just-another-string-ä-test
Which indeed is much easily decoded than the "almost-double-auml" I got with the first string. In addition to the final letter/word replace I also noticed that things work as expected when I enter a line break in the Blade template after the line.
{{ html_entity_decode('just-another-string-ä') }}
{{-- erase this comment --}}
And everything is in order in the source code:
just-another-string-ä
Have I completely missed something here or does this smell like a bug?
Okay I've found the problem, though not really much of a solution.
After looking into this I found that it's not a Blade issue. Neither is it PHP or Apache - it's your browser.
For example, just create yourself an HTML file with the following contents:
this-is-a-string-ä
For me (at least in Chrome, I haven't tested other browsers), this will produce the same issues as you are seeing. If you have no trailing newline, view source will break, but if you do have one, it's fine.
So the solution is simple, enable the "blank newline at end of file" setting in your text editor. You should really have this turned on anyway, for example diffs work a touch better with a blank line at the end of a file (they don't see a difference where there is none), which means, by extension, version control systems like Git handle them a bit better. And it doesn't really hurt to have this enabled that I've ever found.
I would imagine that this is almost certainly a known issue, but I haven't looked into Chrome issue tracker or anything. Feel free to do so though, if you do want to get to the bottom of it. I'd be interested to know :)

Add line-break to open graph meta tag [duplicate]

This is an URL I have to send an invitation to an app of mine:
https://www.facebook.com/dialog/send?app_id=MY_APP_ID&
name=hola&
link=http://www.aWebSite.com&
picture=http://www.aWebSite.com/im01068442.jpg&description=participar!&
redirect_uri=http://elsuperdt.com
I'm trying to have a linebreak included within the description, but I just haven't found a way to do so. How do I do it?
I had the same issue and eventually gave up. Facebook seems to have gone to great lengths to avoid letting us have any linebreaks in the description.
The one thing you can do is add a &caption=first%20line which gets you one linebreak between the caption and the description. (There's a pretty short limit on how long the caption can be though - something like 80 characters.)
Update: this no longer works for send dialogs. It does still work for feed dialogs
Try using <center></center> this will create a new line in Facebook dialog description.
Try including %0D%0A in your description where you want the line break to be. This is the URL-encoded equivalent of a line break.
\n works in message but not in name parameter
I tried center></center> and %0D%0A. Both worked... for a split second. You could see the breaks upon page load, and then, like evil magic, facebook took it away and it was all scrunched up. Too bad. I'm trying to share a daily schedule, which would look much better with line breaks.
You can use blanks that are not posted to facebook in the length of the feed so the line breaks.
Or you just style your post by adding ".........." in the end of each line. This way people would maybe be more attracted to your post as they are eyecatching.

CFEclipse doesn't recognize structName in cfimage tag

This code:
<cfimage action="info" structName="imageInfo" source="#imagePath#">
is giving this error:
The attribute 'structName' is required for the tag. (Found:
[source, structname, action])
When I run this code in CFBuilder - everything is OK, but I must use CFEclipse.
What should I do (I use CF9)?
Thank you for your answers!
Of course this problem won't prevent you from running your application on ColdFusion. It is just an IDE warning that something is wrong.
You have a few options.
Try using a lowercase N in structName. i.e. structname. ColdFusion is not case-sensitive, but Java is, and CFEclipse is a Java application.
If that does not work, then it probably means that the dictionary file that drives the code assist is not correct. You can go earch forthose XML files and update them to include that attribute.
You can use CFBuilder. I know you said you can't, but I have to question why. You know there is a free version that is just as good as CFEclipse, right?
The problem is that there's a casing glitch in that file Peter mentions. There's one reference to "structName" to define the attribute itself, and another "structname" which is in the list defining which attributes are needed for action="info". If you make them both the same, then restart Eclipse, you should be OK (that's I've needed to do to make the error indicator go away).