-
Notifications
You must be signed in to change notification settings - Fork 15
Language plugins
Getting support for programming languages is done through creating language plugins. To be able to having language plugins written in it's native language the plugin interface goes through standard output. In this way any executable or script can act as a language plugin. Language plugins lives in the Languages folder in OpenIDE's root. Each plugin has a single executable file in that folder and all other needed files are placed in a folder in the Languages folder with the same name as the plugin.
Each language plugin needs to support a specified protocol. When the plugin is called with a specific set of parameters it needs to reply with the expected format. The required parameters are:
Every command supported by a language should be given a definition. In this way it will be listed under supported commands by oi and the run window will list the command with completion help.
PARAMETER:
get-command-definitions
RESPONSE FORMAT:
// Wrapping the command name with [] means the command is optional
// All line breaks in this sample can be replaced with space
// This is the definition response for the following new commands:
// new file FILE_NAME
// new directory DIR_NAME
new|"Template command for new file"
file|"Creates a new file"
FILE_NAME|"The path/name of the file you want to create" end
end
directory|"Creates a new directory"
DIR_NAME|"Long description where every line
will be trimmed and new line is replaced by space" end
end
end
Returns a list of supported file extensions. These extensions will be used to determine what files the plugin will be asked to provide projects, files and signatures for. The code engine will also use the list of extensions to determine what language to pick a code snippet from when using a file extension instead of language.
PARAMETER:
crawl-file-types
RESPONSE FORMAT:
.csproj|.cs
When the code engine requests information about projects, files and signatures it will call the plugin with crawl-source. The parameter passed with it is the name of a file containing a file where the content is one line pr file / directory it want the plugin to crawl. When a directory is submitted it expects the directory to be crawled recursively.
PARAMETER:
crawl-source PATH_TO_FILE_CONTIAINING_LINE_PR_FILE_OR_DIR_TO_CRAWL
RESPONSE FORMAT:
// Project is optional. Other than that the hierarchy is as follows
// Indentation is only to show hierarchy not required in output
// Arguments in [] are optional
// typesearch => Is searchable under typesearch
// filesearch => Is searchable under file browse list
[project|PROJECT-PATH [|filesearch]]
file|FILE-PATH [|filesearch]
signature|SIGNATURE|NAME|TYPE|OFFSET|LINE|COLUMN [|typesearch]
reference|SIGNATURE|OFFSET|LINE|COLUMN
Retrieve signature defined by a location inside the code. The information is used for go to definition. When given a position it exects the file and name of the referenced signature together with the start and end of the code reference under the cursor. If nothing is returned it expects that the signature is unknown. For instance if the code under the cursor is "dor.Open();" the response might be:
/path/to/Dor.cs
Building.Dor
1|0
1|3
PARAMETER:
signature-from-position PATH_TO_FILE|LINE|COLUMN
RESPONSE FORMAT (fixed lines):
// The response have fixed lines as shown below
// The position is the start and end position of
// the reference under the position passed to it
// If not found return nothing
FILE_CONTAINING_REFERENCED_SIGNATURE
REFERENCED_SIGNATURE
REFERENCE_START_LINE|REFERENCE_START_COLUMN
REFERENCE_END_LINE|REFERENCE_END_COLUMN
Want's the members listed for a specific signature. Often used in combination with signature-from-position by the code engine. The members returned are used among others by the member look up window (intellisense). If nothing is returned it expects that the signature is unknown.
PARAMETER:
members-from-signature SIGNATURE
RESPONSE FORMAT:
// A list if available members with descriptions
// One line pr member. In the description part new line
// is represented by [[[[newline]]]]
SomeProperty|(Int) Some number
Parse(string[])|(Returns string) Parses lines[[[[newline]]]]\tstring[] Lines
Various language plugin commands. This would be any custom command defined by the plugin
PARAMETER:
Whatever specified in command definitions
RESPONSE FORMAT:
// Whatever supported oi commands you want executed
// The error and comment general output commands are also supported
// To report an error: error|ERROR_DESCRIPTION
// To report print a comment: comment|COMMENT
// Below is a simple sample
comment|File /home/me/myfile created
editor goto /home/me/myfile|3|18
editor setfocus