Class VisualStudioEditor
Implements
Inherited Members
Namespace: Microsoft.Unity.VisualStudio.Editor
Assembly: Unity.VisualStudio.Editor.dll
Syntax
[InitializeOnLoad]
public class VisualStudioEditor : IExternalCodeEditor
Methods
CreateIfDoesntExist()
Declaration
public void CreateIfDoesntExist()
Initialize(string)
Callback to the IExternalCodeEditor when it has been chosen from the PreferenceWindow.
Declaration
public void Initialize(string editorInstallationPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | editorInstallationPath | Path of the chosen code editor. |
OnGUI()
Unity calls this method when it populates "Preferences/External Tools" in order to allow the code editor to generate necessary GUI. For example, when creating an an argument field for modifying the arguments sent to the code editor.
Declaration
public void OnGUI()
OpenProject(string, int, int)
The external code editor needs to handle the request to open a file.
Declaration
public bool OpenProject(string path, int line, int column)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | |
| int | line | Line number to open the file on. |
| int | column | Column to move cursor to on the specific line. |
Returns
| Type | Description |
|---|---|
| bool | Whether the request went successfully. |
SyncAll()
Unity calls this function during initialization in order to sync the Project. This is different from SyncIfNeeded in that it does not get a list of changes.
Declaration
public void SyncAll()
SyncIfNeeded(string[], string[], string[], string[], string[])
When you change Assets in Unity, this method for the current chosen instance of IExternalCodeEditor parses the new and changed Assets.
Declaration
public void SyncIfNeeded(string[] addedFiles, string[] deletedFiles, string[] movedFiles, string[] movedFromFiles, string[] importedFiles)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | addedFiles | Added files through Unity's UI. |
| string[] | deletedFiles | |
| string[] | movedFiles | Files that was added but has been moved. |
| string[] | movedFromFiles | Same list as movedFiles, but contains the location of where these was moved from. |
| string[] | importedFiles | Imported files, which were not added through Unity's UI. |
TryGetInstallationForPath(string, out Installation)
Declaration
public virtual bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation)
Parameters
| Type | Name | Description |
|---|---|---|
| string | editorPath | |
| CodeEditor.Installation | installation |
Returns
| Type | Description |
|---|---|
| bool |