I Am trying to write an own language definition for Promela/Spin and installing it in my Sublime Text.
But I cannot find any way how I can Install the definition.
What format do they need to be in? JSON? PLIST? Where do I need to put them to use?
http://docs.sublimetext.info/en/latest/extensibility/syntaxdefs.html
Sublime Text uses property list (Plist) files to store syntax definitions. However, because editing XML files is a cumbersome task, we’ll use JSON instead, and convert it to Plist format afterwards. This is where the AAAPackageDev package (mentioned above) comes in.
http://sublimetext.info/docs/en/extensibility/packages.html
This is an exhaustive list of Sublime Text resources than can be found inside a package:
... ... syntax definitions (.tmLanguage) ... ...
Installing a package:
There are three main ways to install packages:
.sublime-package archives
version control systems
copy-pasting of files
Related
How VSCode parses json files like language-configuration.json that is used to describe language extensions? I see that these files contain comments and many, like typescript, contain trailing commans.
If such content is parsed using JSON.parse() the error will be raised.
I implement an extension that reads these config files and like to use the same parsing method that is used in vscode.
Thank you
I would assume they use the jsonc-parser - since it is written by one of the vscode team and has 3 million+ downloads a week.
npm package: jsonc-parser
I use it myself because I need to parse complicated custom settings that might have comments in them for example.
Add the package to your dependencies. npm install --save jsonc-parser
Then import it (I have it in a js extension for now):
const jsonc = require("jsonc-parser");
const rootNode = jsonc.parseTree(document.getText());
Let's say that i have file /home/foo/myfile without extension. Is there option to add syntax setting into this file? In vim it's :set syntax=javascript. I know that in Sublime you can set default syntax color.
There's similar question Changing default syntax based on filename but there you set specific filename. I need to set it in file itself, since i have a lot of different files without extension.
The package ApplySyntax should be able to do what you want.
ApplySyntax is a plugin for Sublime Text 2 and 3 that allows you to
detect and apply the syntax of files that might not otherwise be
detected properly. For example, files with the .rb extension are
usually Ruby files, but when they are found in a Rails project, they
could be RSpec spec files, Cucumber step files, Ruby on Rails files
(controllers, models, etc), or just plain Ruby files. This is actually
the problem I was trying to solve when I started working on this
plugin.
Set your rules/filenames in the ApplySyntax.sublime-settings file:
// "rules" is a list (array) of checks that you want to make against
the file in the current view. A rule is either a regular expression
or a function. If using a regular expression, you can specify
whether you want it tested against the "file_name" or the first
line of the file (think shebangs and xml files). If the rule is a
function, you must provide the path to the file containing the
function and the name of the function to call. When this function is
called, the "file_name" will be passed to it as the only argument.
You are free to do whatever you want in your function, just return
True or False.
you can do this on the fly through the command menu (on OSX cmd+shift+p, windows ctrl+shift+p) then type what you need (e.g. javascript) and it will come up in the list set syntax: JavaScript.
Sublime will remember this until you close the file
The porting guide states that:
Packages in Sublime Text 3 are able to be run from .sublime-package
(i.e., renamed .zip files) files directly, in contrast to Sublime Text 2, which
unzipped them prior to running.
While in most changes this should lead to no differences, it is
important to keep this in mind if you are accessing files in your
package.
So how do I access files in my own package? My plugin comes with some static files that it must use.
You can use sublime.load_resource(name) where name is (from the API docs)
Loads the given resource. The name should be in the format Packages/Default/Main.sublime-menu.
I am using ubantu and trying to configure ctags on sublime text 2 for rails.
I am getting the above error message on opening my sublime text.
On re building ctags its completing within a flash without generating a .ctag file in the specified location.
My guess is that is an empty file right now. Open the file (possibly through another editor) and insert {}. The settings files are JSON objects. That just looks like it's failing the JSON parse.
You could run cat ~/.config/sublime-text-2/Packages/User/CTags.sublime-settings to see if there is anything in the file. If there is not you could freely delete it.
Though this error could be caused by a plugin that requires some configuration looking for its preferences file and failing.
During install I need to extract a text file from Binary data and place it in TempFolder so it can be used by a dll I don't control. It needs to be passed the file-name of the text for processing.
I thought I could use a simple custom action to invoke xcopy to copy the data but how do I identify the contents of the binary table?
Secondly, customaction supports various actions but I don't see anything obvious to just drop the binary item into the TempFolder.
Any ideas?
There's nothing built in to MSI or WiX to do that. You can just install the file normally and reference its path using [#fileId] formatted syntax.