Giter VIP home page Giter VIP logo

sublime-unity-completions's Introduction

Unity Completions

Package for Sublime Text

This package provides auto-completions for Unity classes, variables and functions. It works with all Unity-supported languages: JavaScript, C# and Boo.

There exists a lighter version of this package. The auto-completions pop-up menu shown by the light package is not as nice and informative, but on the other hand the light package does not add any delay to Sublime Text's loading time. If you open and close Sublime Text frequently, I recommend using the light version.

Installation

Package Control

The easiest way to install this package is using Package Control. Choose to install the "Unity Completions" package. (See installation and usage for help.) Package Control will also keep you updated.

Troubleshooting

Package Control may get stuck while installing the library. If that happens you'd see the animation running at the bottom indefinitely:

Installing

This seems to be a bug in Package Control. I'm not sure what causes it - perhaps the relatively large size of this package. You are welcome to try the following solutions:

  1. Wait a little longer - it may take a few (3-5) minutes!
  2. Restart Sublime Text and try again, this time standing on one foot
  3. Check your user settings (Preferences.sublime-settings) and make sure the package is not listed under "ignored_packages"
  4. Consider using Unity Completions Light

Manual

Alternatively you can install this package manually:

  1. Open the packages directory from the Sublime Text menu (Preferences | Browse Packages...)
  2. Create a new directory called "Unity Completions"
  3. Copy the contents of this package into the new directory

Usage

Simply start typing any Unity term or press Ctrl+Space. You don't have to be accurate - a few consonants may be enough, preferably in the right order.

For example, type in gbjact and you will instantly be offered completions with these letters:

gbjact

Notice the type on the right side: [var] for variables, [class] for classes or parentheses with parameter names for functions.

Another example. Type in pscast and you will be offered:

pscast

Notice that functions may appear multiple times if they have several definitions. They can be distinguished by the parameter names. (The pop-up is too small to include the types...)

Once you select a function completion, a full snippet will be inserted, including the parameter types, names and default values:

SphereCast

You can then use Tab and Shift+Tab to quickly navigate between the parameters.

Limitations

The Unity Completions plugin is simple. It does not analyze the code to detect variable types. It only relies on the word being typed. In addition, Sublime Text's auto-complete is interrupted by dots. Typing in a dot will cause Sublime Text to ignore anything before the dot.

Let's say, for example, that you have a variable named enemy of type GameObject and you want assistance writing enemy.activeInHierarchy. Typing enemy. (with a dot) will not work. As soon as you type in the dot the completions pop-up will close.

If you continue typing after the dot, for example enemy.activein, you will be presented with completions, but they will only be based on the part after the dot: activein.

Suppose you choose the completion activeInHierarchy, you will end up with: enemy.GameObject.activeInHierarchy. The class name is inserted together with the variable name. Simply delete the class name manually.

Status

Up to date with Unity version 2019.2.16.

Generation

The Unity Completions package files were generated automatically using this generator. The data is based on the Unity Scripting Reference.

Boo Developers

Ahoy!

If you're developing in Boo, know that this package recognizes .boo files, but I recommend installing the Boo package as well if you're into syntax highlighting.

License

(The MIT License)

Copyright (c) 2013 Ofer Reichman

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

sublime-unity-completions's People

Contributors

oferei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sublime-unity-completions's Issues

Autocompletion for MonoBehaviour is Incorrect

Its either the entire MonoBehaviour hierarchy is missed, or the "this" hierarchy. I'm hazarding the former, as I was able to get it to autocomplete a function I added to a class, but was unable to get it to suggest "this.gameObject" ( http://docs.unity3d.com/401/Documentation/ScriptReference/Component-gameObject.html?from=MonoBehaviour ), it kept wanting to insert a class definition, eg. "this.Component.gameObject" (and the options available do not include MonoBehaviour and all treat the result as a static field of the class, which is incorrect).

It also appears that it is unable to autocomplete for any fields added to any referenced classes. E.g. if I add a field to a class called Main, then reference an instance of Main, I can't get an autocompletion for its member fields or methods. eg.:
Main mainRef;
mainRef.someProp = true; //not autocompleted, but exists
mainRef.doTheThing(); //not autocompleted, but exists
this.doSomething(); //autocompleted (although parens and any parameters are omitted)

Autocompleting "GameObject.find" results in "GameObject.GameObject.Find(string name)" which is wrong, on account of the duplicate class reference which won't compile: UnityEngine.GameObject' does not contain a definition forGameObject'

I'm coming back from a long hiatus away from Unity, having been over in Java using Eclipse, and I find my editors sorely lacking (and I broke MonoDevelop trying to get a newer version working, after finding serious bugs). Eclipse showed me how awesome a good IDE is and now I want those tools for the other languages I work in. A friend suggested Sublime Text, but without good autocompletion for both the Unity namespace and my project namespace, I will not find developing a large project enjoyable.

Package not working correctly

Hello @oferei,

I know it's a lot of work and you've must been busy, but I wanted to let you know that the package isn't working even if I install it manually.

Sublime do hangs a little when starting and some other times, but the package didn't work as intended.

However the Light version is working all fine.

More details: Windows 11 - ST 3 - Unity 2021 LTS

Is there's something I could do to help?

Thanks for both packages though, they currently are the only solution I found for using ST with Unity (with the Light one to be the only one that works).

ZIP not working.

Tried downloading a .zip, but it only packages BOO folder, no other folders are added.

Not installing properly.

Hi,

To let you know for starters, I've used Sublime a fair bit and I know the deal with the package manager so I'm certain this isn't down to user error (though never say never).

I've tried to install through the package manager and though it downloads most (if not all) of the files the installation never completes and the installing dialog still appears at the bottom of the window. If I give it plenty of time it doesn't change and closing and restarting the package doesn't appear to function.

If I download a zip of the master it doesn't download the C or JS folders, just the Boo one. When I clone via the GitHub app I get all the files but copying these with a manual install doesn't seem to work either...

Any ideas?

Why insert class name?

Constantly having to delete the "ClassName." component is more cumbersome than occasionally having to insert the class name.

Issue with Auto Complete adding extra words and characters

In Mono and using unityvs for Visual Studio when you go to auto complete a line such as Input.GetkeyU and hit tab it just fills in to the end which allows you to continue working

This is the result of doing it in Visual Studio

if(Input.GetKeyUp)

The cursor is possitioned right after the p so I can add in my (KeyCode.X)

In Sublime Unity Completions there are several issues

What I get is this

if(Input.Input.GetKeyUp(KeyCode key);)

It is adding an additional Input command at the top

It Higghlights the entire KeyCode key area where it should just place a cursor after KeyCode. as that will be the useage of this command 99% of the time

Also it adds a comma at the end not detecting that it is in an if statement

Possible Fix to @Limitations listed in Readme

Anaconda package uses this to allow . to be used in autocompletion. If you are familiar with sublime syntax ways you could most likely do an equivalent for c#.
This should easily fix the issue

I will try to edit this post after I test it myself to confirm the solution

{
    "auto_complete_triggers": [{"selector": "source.python - string - comment
    - constant.numeric", "characters": "."}]
}

Unable to install from Package Controll

There is an issue with installing it with the package control on Sublime 3

When attempting here I keep getting the error

Package Control: Skipping file from package named Unity Completions due to an invalid filename
Package Control: Skipping file from package named Unity Completions due to an invalid filename
Package Control: Skipping file from package named Unity Completions due to an invalid filename
Package Control: Skipping file from package named Unity Completions due to an invalid filename
Package Control: Skipping file from package named Unity Completions due to an invalid filename
Package Control: Skipping file from package named Unity Completions due to an invalid filename
Package Control: Skipping file from package named Unity Completions due to an invalid filename
Package Control: Skipping file from package named Unity Completions due to an invalid filename
Package Control: Skipping file from package named Unity Completions due to an invalid filename

which repeats indefinitely.

Installing it manually works fine so it is only an issue with installing it with the package manager

Completes appearing before the keyword

Hi there,

I'm loving these completions, but I keep running into this issue and maybe it's just something to do with I'm using them.

The problem I am having is this -
I start typing some thing (like instantiate) and it has picked out the right completion for me, ace!
screen shot 2015-07-08 at 9 20 03 pm

But when I hit enter it will always add the class in front, like "Object" here.
screen shot 2015-07-08 at 9 20 15 pm
So i have to go back and delete the "Object" part.

Here's another example with localEulerAngles.
screen shot 2015-07-08 at 9 27 23 pm

screen shot 2015-07-08 at 9 27 31 pm

Any ideas on how I could get it to stop this? Apart from that it really is working great...

Thanks,
Pete

Freezes Sublime Text 3 on startup (version from Package Control)

When this package is installed and enabled it works fine, but when starting up ST3, this package is the reason for ST3 freezing.

When extracting the contents of the ".sublime-package" to the Packages folder, it works flawlessly. Cloning from this repository also works, but has a different problem.

Could be something to do with the 60k files that get made by the generator.

When debugging the last line is just:
plugin_api.cc:2588 start_api launching: /opt/sublime_text/plugin_host

CPU is not used at all when this freeze happens.

My related specs:
OS: Ubuntu Linux 13.10/14.04

Listing other installed packages just in case there is some conflict with them:
"ApplySyntax",
"SideBarEnhancements",
"Unity3D",
"Unity3D Snippets and Completes"

Does not install

Sublime won't install it.
No error message, no message in console.
Any way I can check this?

It lists in the "ignored_packages" section in the user config and the animation at the bottom left runs forever.

Auto-complete inherited names

Offer auto-completions for inherited variables and functions.
This is an open discussion, as the solution isn't obvious.

Currently, inherited attributes are not displayed by choice. This means that the auto-completion "MonoBehaviour.gameObject", for example, is quite hard to find. If you know it's inherited from Component then you can type "comgam", but users shouldn't need to know that. Typing "gameobj" is not much of a help, as the correct auto-completion is nearly #50 in the list. Preceding it are all the auto-completions for the GameObject class, as ordered by Sublime Text.

A naive solution would be to enable showing inherited attributes. However, then each class would have tons of attributes and the auto-completion list may become bloated. Attributes would appear multiple times, especially if they are inherited by many classes. The SNR (signal-to-noise ratio) might suffer.

Perhaps a solution lies in re-ordering of the auto-completions list. Assuming it's possible to provide a simple definition for which auto-completions should appear first (which should work in various scenarios.)

class names are being added

Hello! Thank you for the awesome package here. It has made my Unity C# programming far easier. Without this for Sublime Text I'd probably be stuck in Mono, and nobody wants that!

I've got just one thing: when I autocomplete something, it adds the class name and not just the variable. For example, if I start typing:

myObject.tran

It pops up with all the correct code completion options - all the classes in Unity with "transform" that exist. When I hit enter or tab to do the completion however, it ends up like this:

myObject.GameObject.transform or myObject.Collision.transform or whatever class I happen to hit enter or tab to autocomplete on, instead of just this:

myGameObject.transform

Is there any way to stop it from adding the class to the code completions?

Files skipped while installing through PackageManager, due to errors in filename.

In the Troubleshooting section you mention:
"Package Control may get stuck while installing the library. If that happens you'd see the animation running at the bottom indefinitely ..."

"This seems to be a bug in Package Control. I'm not sure what causes it - perhaps the relatively large size of this package."

I tried to investigate what was causing the error, hitting Sublime Text -> View -> Show Console, and then I had this output while the Package Control got stuck:

Package Control: Skipping file from package named Unity Completions due to an invalid filename
Package Control: Skipping file from package named Unity Completions due to an invalid filename
Package Control: Skipping file from package named Unity Completions due to an invalid filename
Package Control: Skipping file from package named Unity Completions due to an invalid filename
reloading Packages/User/Package Control.sublime-settings

The last line was just the succesful exit, the package was finally installed (like 3 minutes after).

What files are causing this issue? It seems that it would be a lot faster if you fix those filenames.

Wrap attributes

Wrap attributes in brackets (C#, Boo) or prepend with "@script" (JavaScript).
For example:
@script RequireComponent(requiredComponent : Type)
[RequireComponent(requiredComponent as Type)]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.