How can I apply launch.json schema to other files - visual-studio-code

How could I apply the schema of .vscode/launch.json to other files, like .vscode/launch.examples.jsonc for example?
What are my options?
Schema association is defined here https://github.com/microsoft/vscode/blob/1ed7421b6d1edba54e51c7a8fb27201687cd2470/extensions/configuration-editing/package.json#L117-L118, but that's not an acceptable path for https://github.com/redhat-developer/vscode-yaml
There is no such json file I could find in the repo that describes schemas, e.g. here https://github.com/microsoft/vscode/tree/main/extensions/configuration-editing/schemas
There's no way to add https://github.com/microsoft/vscode/blob/1ed7421b6d1edba54e51c7a8fb27201687cd2470/extensions/configuration-editing/package.json#L117-L118 configuration on settings.json, and it will be a mess to re-compile VSCode "just for this change" (and ofc it doesn't scale).
Setting the editor.defaultFormatter to vscode.configuration-editing does not work like:
"[launch.examples.jsonc]": { ... }
https://gist.github.com/tsinis/f9d4cef8da42ce2a7a21a10b7512222d#file-default-settings-json-L77
I also want to enforce trailing commas, but without having to write a schema for the file (https://github.com/microsoft/vscode/issues/102061#issuecomment-656541600)

Related

How do I configure mplayer to use a default edl file name?

I want to configure mplayer to look for an edl when playing a video. Specifically, I want it to use "show.edl" when playing "show.mp4", assuming both are in the same directory. Very similar to how it looks for subtitles.
I can add a default edl in the config file by adding the following:
edl=default.edl
And this will look for the file "default.edl" IN THE CURRENT DIRECTORY, rather than in the directory where the media file is. And it isn't named after the media file either, and thus even if it did look in the right place, I'd have one single edl file for every media file in that directory.
Not really what I wanted.
So, is there a way, in the "~/.mplayer/config" file, to specify the edl relative to the input file name?
Mplayer's config file format doesn't seem to support any sort of replacement syntax. So there's no way to do this?
MPlayer does not have a native method to specify strings in the config file relative to the input file name. So there's no native way to deal with this.
There's a variety of approaches you could use to get around that. Writing a wrapper around mplayer to parse out the input file and add an "-edl=" parameter is fairly general, but will fail on playlists, and I'm sure lots of other edge cases. The most general solution would of course be to add the functionality to mplayer's config parser (m_parse.c, iirc.)
The simplest, though, is to (ab)use media-specific configuration files.
pros:
Doesn't require recompiling mplayer!
Well defined and limited failure modes. I.E. the ways it fails and when it fails are easily understood, and there aren't hidden "oops, didn't expect that" behaviors hidden anywhere.
Construction and updating of the edl files is easily automated.
cons:
Fails if you move the media around, as the config files need to full path to the edl file to function correctly.
Requires you have a ".conf" file as well as an EDL file, which adds clutter to the file system.
Malicious config files in the media directory may be a security issue. (Though if you're allowing general upload of media files, you probably have bigger problems. mplayer is not at all a security-hardened codebase, nor generally are the codecs it uses.)
To make this work:
Add "use-filedir-conf=yes" to "/etc/mplayer.conf" or "~/.mplayer/config". This is required, as looking in the media directory for config files is turned off by default,
For each file "clip.mp4" which has an edl "clip.edl" in the same directory, create a file "clip.mp4.conf" which contains the single line "edl=/path/to/clip.edl". The complete path is required.
Enjoy!
Automatic creation and updating of the media-specific .conf files is left as an exercise for the student.

Adding Author Metadata to a TXT or CFG file

Basically I am looking for a way of "branding" a cfg file. Specifically a CSGO-config, so yes, nothing too important. I'm just surprised, that after quite a bit of google search, I still havent found anything.
In general, plain text files (and probably .cfg files) do not contain any metadata by default. The file system should keep track of some properties for these file types, but they won't otherwise transfer across filesystems.
If you would like to "brand" your file, perhaps you could add a comment to the top with your name. It would be about as permanent and immutable as any metadata anyways.

Is there a way to ignore temporary folders in RTC client?

I have temporary files created in separate folders inside my source tree which I would like to ignore. Something like:
project/
|--component/
|--.jazzignore
|--file.src
|--file-9df29e29373e66caef72/
|--file.src.tmp
I already ignore file.src.tmp by extension using .jazzignore, but I would also like to ignore the file-9df29e29373e66caef72/. The folder looks empty in the "Unresolved" category for the component, but since its name changes over time, I cannot ignore it by name.
since its name changes over time, I cannot ignore it by name.
Still, if you know its naming convention, you might consider an ignore pattern:
core.ignore= \
file-*
Note it is non-recursive, you that would ignore any file, folder or symlink named file-... anywhere under component.
Here, that would ignore only file-... directly under component.
Eclipse workspaces often include files or folders, such as compiler output, log files, and so on, that you do not want to place under source control.
You can specify resources or classes of resources to be ignored by Rational Team Concert™ source control. Ignored resources are never checked in.
A .jazzignore file is used to prevent items from being checked into change sets.
A .jazzignore file consists of a series of patterns. Any file, folder, or symbolic link whose name matches a pattern cannot be committed to a change set.
There are two types of patterns in a .jazzignore file:
core.ignore patterns, that are effective in the same directory as the ignore file; and
core.ignore.recursive patterns that affect items in all of the directories below the .jazzignore file.

How to make VS Code treat files without extension as a certain language?

At work there are a lot of file without extension. They are all COBOL files, so now I manually change their associating to COBOL each time I open one. But I was looking for a way to make VS Code treat files without extension as COBOL automatically.
I know you can add file associations in the settings, but the only thing that works is to add "*": "COBOL" there, but then everything is considered a COBOL file... I also tried `"[^.]": "COBOL" hoping regex would work but it didn't.
Is there a way to do this?
You can apply the file associations to all files in a given directory only:
"files.associations": {
"**/RootDir/**/*": "COBOL"
}
This way, all files in /RootDir/, or one of it's sub-directories, will be mapped to COBOL.
All files outside of /RootDir/ will still be mapped as usual according to their extensions.
Suppose your /RootDir/ doesn't contain only COBOL-files, but also some other file types. In this case you can go further and define exceptions for the file associations:
"files.associations": {
"**/RootDir/**/*.bat": "bat",
"**/RootDir/**/*.sh": "shellscript",
"**/RootDir/**/*": "COBOL"
}
Basically you're instructing Visual Studio Code to map all files in /RootDir/ to COBOL, except for .bat and .sh which are mapped as Batch and Shellscript, respectively.
As above, all files outside of /RootDir/ will still be mapped as usual according to their extensions.
I went through the same problem with php_cs-fixer config file.
This one is generally .php_cs.
I only have to add this line
"files.associations": {
"*.php_cs": "php"
},
AND relaunch vscode and .php_cs is now a php formatted file.
hope this help.
Just found another possible solution which works best for me.
I was trying to get shell lang selected for the .ssh/config and it worked by just adding
#!shellscript
at the very beginning of the file, maybe this doesn't work with all files/languages but it can be useful

in org-mode, how to specify name of exported file?

In org-mode, when I export to PDF or HTML, I'd like to specify the names of the resulting files. Ideally two separate names, one for the PDF, one for the HTML. Is this possible?
Chris's answer is out of date. There is now an EXPORT_FILE_NAME setting:
#+export_file_name: <filename>
If you put this at the start of your file (not in a subtree), it will name the entire file that when you export.
Edit: For newer versions of org-mode, see slondr's answer.
It doesn't look like you can specify a name for the exported file as a whole.
From the link, emphasis mine:
When exporting only a subtree, each of the previous keywords can be overriden locally by special node properties. These begin with ‘EXPORT_’, followed by the name of the keyword they supplant. For example, ‘DATE’ and ‘OPTIONS’ keywords become, respectively, ‘EXPORT_DATE’ and ‘EXPORT_OPTIONS’ properties. Subtree export also supports the self-explicit ‘EXPORT_FILE_NAME’ property [4].
[4] There is no buffer-wide equivalent for this property. The file name in this case is derived from the file associated to the buffer, if possible, or asked to the user otherwise.