emmet expression can't expanded in .vm file when use vs code - velocity

I change my editor to vs code recently and then setup a lot of plugins. I use velocity(.vm) in our project but use emmet to expand expression in a vm file with vs code.
It doesn't work and I try to slove it and find the source option file:
C:\Program Files (x86)\Microsoft VS Code\resources\app\node_modules\emmet\lib\snippets.json
Then add this in the bottom json
"vm": {
"filters": "vm",
"extends": "html",
"profile": "xml"
}
But it doesn't work too. So, I will ask that how do you solve this problem in your project module file (like .ejs .php...)?
Or if find the wrong place to modify the code ?
My Environment is: win 10 vs code 1.4.0

filter is a name of a special JS method that formats expanded abbreviation. It had nothing with a document syntax. In your case, you have to find out how VS detects syntax for .vm files and then ensure that this syntax is supported by Emmet. E.g. the name of the syntax might be “velocity”

Related

Webpack: Why there are multiple files with same file name when search the source code?

I am using vue.js (2.6.5) and webpack (5.77.1), and I enabled the source map feature in development env, with simple config as below:
mode: 'development',
devtool: 'eval-cheap-module-source-map',
.....
Well, the source map feature indeed works, but what confuse me is when you search a file name, there will be multiple files with same file name listed, see as below:
Only one of them is the exact original file definition, other files are definitions of render function of vue.js and some others. Every time I need to click on each one of them to check which is the exact original file, this annoys me, does any one know how to only show the exact original file ?

Find invalid image paths in vue project

In my Vue 3 project, all images are located in public/assets/image then in .vue files I refer to these images like assets/image/image.png.
Sometimes I might make a typo in a path or a path might not be correct anymore.
Is there any automated way to find and fix all incorrect paths in a project?
I am using "VS Code" and "IntelliJ IDEA" might be there are any plugins to handle this.
In VS Code there is an extension called Image preview
https://marketplace.visualstudio.com/items?itemName=kisstkondoros.vscode-gutter-preview
If the path is right it shows the image at the left side of the import.

Vue: Failed to compile (Strings must use singlequote)

I've been working with Visual Studio Code for two days now. I try to build a Vue-Application. But always when I run the application by npm run serve, I get the following errors:
9:9 error Strings must use singlequote quotes
9:15 error Missing trailing comma comma-dangle
✖ 2 problems (2 errors, 0 warnings)
2 errors and 0 warnings potentially fixable with the `--fix` option.
I understand what these errors say, and I tried to type in strings in singlequotes and insert commas at the end of every line. But Visual Studio Code always removes the comma and turns singlequotes to doublequotes... Here you can see which plugins I have installed:
I had the same problem. It is likely caused by the file being formatted twice - first by vs code and then by eslint built in into vue-cli. Set the formatOnSave setting in VS Code to false and check if this solves your problem. It might. Nonetheless if you work on various (non-Vue) projects you will have to enable and disable this setting.
Disclaimer: This is a workaround that works for me. There's probably a more professional approach, I was not able to find it though.
Just in case this helps someone else. I too ran into this issue. I have this line in a components script:
props: ["login-signup"]
Every time I save it would switch to a double quote. I want formatting on save so that I don't have to mess with spacing and tabs. For me, I use vue3snippets extension in vscode. Opening settings (File->Preferences->Settings I typically use workspace, not user so I clicked Workspace) and searching for "singlequote" showed that "Vue3snippets: Single Quote" has a setting called "if true, will use single instead of double quotes" that was unchecked.
Checking this fixed the issue where the single quote in my line above would not format on save to a double quote and in turn fixing this error for me.
go to your main folder open .eslintrc.js and add the following in the rules
"
quotes: [0, "double"]
and then restart the project and do npm serve run again
I have found another way to fix the problem for the current project: I just created a
.prettierrc
config file, in which it is possible to specify the quote style with
"singleQuote": true
This might be a more general approach to tackle such a problem, because the direct project config apparently overrides the global configuration

IntelliJ syntax highlighting for jinja files (.jinja, .j2)

Question is pretty much in the title. Does IntelliJ have native syntax highlighting for .jinja and .j2 files?
If not is there a plugin?
This plugin: https://plugins.jetbrains.com/plugin/7792-yaml-ansible-support offers some support for jinja files.
To ensure that this plugin is associated with jinja files:
Go to File > Preferences > Editor > File Types
Under Recognized File Types scroll down to YAML/Ansible and select it
Under Registered Patterns click the + icon and enter *.jinja.
With this configuration in place your jinja files will open into this plugin. If they do not, then jinja files must be already associated with one of the other Recognized File Types in which case you'll need to scroll through them to find the culprit and remove *.jinja from its Registered Patterns.
Try the Python plugin with IntelliJ IDEA Ultimate, that has support for Jinja2 Templates.
With recent version of Intellij, you don't need any plugin any more.
Go to File > Settings > Editor > File Types
Under Recognized Files Types, choose Jinja 2 Template
Under File Name Patterns add *.j2 for jinja2, and/or *.jinja for jinja
For Ansible yaml jinja 2 templates:
Under Recognized Files Types, choose YAML/Ansible
Under File Name Patterns add *.yaml.j2 and *yml.j2
Just for sanity sake. I found my solution in a combination of both answers previously posted.
Besides the Python plugin as #Andrei states it is needed that the file extension is recognized as explained above by #glytching: File > Preferences > Editor > File Types, for me the pattern *.j2 was missing.
As a good thing to do also would be to mark the directory as Template as described in section To define template directories on the referenced templates link given by #Andrei:
1. In the Settings/Preferences dialog, click the Project Structure page.
2. Choose the directory to be marked as a template root.
3. Do one of the following:
* Click Templates on the toolbar of the Content roots pane.
* Choose Templates on the directory's context menu.

Xcode - how to change file's target membership via command line?

Is there a way to change file's target membership in Xcode project via command line?
Here's what I'm trying to do via Xcode's UI:
I also had to do this for CI. After lots of digging, I do not believe this is common enough for anyone to have written a tool to help with doing.
The only conclusion I came to was to edit the project.pbxproj file directly, which is never a great thing to do. None of the tools which claim to do this were of any help until I found this stackoverflow answer on editing the project.pbxproj file. Essentially, you can convert the project.pbxproj file into a JSON format using plutil -convert json project.pbxproj and use a JSON manipulation tool to make those files as headers then point them to be headers of whichever target you would like.
When converting the project.pbxproj into JSON format, be aware that Xcode will no longer be able to show you the project navigator for that project. It will still build and run, however, so this is really only useful if you're planning to do this right before building (such as for CI).
(EDIT: As of July 2022, Xcode will now properly read a JSON version of its .pbxproj to allow you to view your files in the project navigator. I'm not sure which version introduced this, but it is at least now possible with later versions of Xcode.)
The format project.pbxproj as JSON has nearly all the important data under the "objects" key. The file you want to be a header already has an entry with the key being the UUID for the file and a path value you can use to relate the UUID to your file. Here's an example of that format:
// UUID for your file
"65TYSSDXHSLP4UUOAD9D40C322AAGHM9": {
"path": "MyHeader.h", // Your file's name
"isa": "PBXFileReference",
"includeInIndex": "1",
"lastKnownFileType": "sourcecode.c.h",
"sourceTree": "<group>"
}
There's another entry to declare this file as a header, which has its own UUID and a reference to the UUID of your file:
// UUID for your file as a header
"YU3BSD39O9PT5RESDFV741D1": {
"isa": "PBXBuildFile",
"fileRef": "65TYSSDXHSLP4UUOAD9D40C322AAGHM9", // UUID for your file MyHeader.h
"settings": {
"ATTRIBUTES": [
"Public" // could also be Project or Private
]
}
}
Then finally, your target has a list of header files where you will want the UUID for the header reference to go.
"A82GAE9A5HUIO063IOPQAAQIUFGSNXZ": {
"isa": "PBXHeadersBuildPhase",
"buildActionMask": "2147483647",
"files": [
"YU3BSD39O9PT5RESDFV741D1" // UUID for your file as a header
],
"runOnlyForDeploymentPostprocessing": "0"
}
Again, changing the project.pbxproj file directly is never a great idea, but until there's a better tool for making these changes without using Xcode, it's the best I could find. If anyone else is aware of something I'm not, please let me know.