WebStorm Vue-i18n, anyway to get editor autocompletion support? - intellij-idea

I'm localizing a webapp using vue-i18n. Is there anyway to get WebStorm to recognize strings in a function prefixed with $t as a dot notation path reference?
$t('messages.some.key')
in my en.js file which looks like:
exports defaults {
messages: {
some: {
key: "Foo"
}
}
}
It would be nice if it provided me with autocomplete and also syntax highlighting if the key doesn't exist.

Old question but still unanswered... For those who have been looking for it and ended up here (like me), meanwhile there is a plugin: https://plugins.jetbrains.com/plugin/12981-i18n-support (https://github.com/nyavro/i18nPlugin)
See https://kazupon.github.io/vue-i18n/guide/tooling.html#i18nplugin-intellij-platform for more information how to configure the plugin.

Related

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.

determining the language of a file from its filepath

In my VSCode extension I have a string filePath and need to know its associated language.
As the user can change the language associations in the configuration (files.associations) only checking for the known extensions does not work.
Is there a functionality in the VSCode API to do that? Or do I need to extract the information from the configuration using vscode.workspace.getConfiguration("files").get("associations")?
Try using workspace.openTextDocument and document.languageId:
import { workspace } from 'vscode';
workspace.openTextDocument(pathToMyFile).then(doc => {
console.log(doc.languageId)
})
This only opens the document from the disk, it will not show it in the editor.

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

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”

Tern Autocomplete with Express

I'm using the tern_for_vim plugin for developing node applications. Currently various functions aren't displaying and I'm unsure why. For example: none of the html verb functions appear in the autocompletion list app.get (after assigning var app = express()) however app.listen does and I'm unsure why. I have searched around but can't find anywhere documenting usage of tern with express. Does anyone have a solution?
I have the following configuration file:
.tern-project:
{
"libs": [
"browser",
"jquery",
"express"
],
"plugins": {
"node" : {}
}
}
libs declaration is used for tern JSON type definitions. Today it doesn't exists express tern JSON type definitions, that's why you cannot use it inside your .tern-project
I have created and initialized tern-express project to support express with tern. Any contribution are welcome!

IntelliJ File and Code Templates error

This isn't specifically code-related, but about the templates of IntelliJ IDEA. In File -> Settings... -> File and Code Templates, it shows the templates of various file types that you can edit (when you create a file of that type, it provides the layout from the template, pretty simple). However, my problem is that it doesn't exactly follow my desired template. For example, let's take the Class type.
This is what I want:
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
public class ${NAME}
{
}
This is what I get:
package name
class name {
}
Why does IntelliJ IDEA ignore my moving of the block character onto the next line? How do I fix this? It's incredibly frustrating.
IntelliJ is deciding where to put the brace using your current code style.