Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

uCodeEditor - A lightweight code editor in Unity Editor

Discussion in 'Assets and Asset Store' started by Amlovey, Apr 27, 2018.

  1. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Version 1.0.9 is submitted to Asset Store. It will be available in few days.

    NEW:
    - Add markdown preview feature.
    - Add check updates feature in About Window.
    - Add `Open file...` action which can open selected file outside project.

    Improvements:
    - Shortcuts can be executed when editor are not focused.
    - Add more C# code snippets which including MonoBehaviour, EditorWindow and debug log etc.

    Bug Fix:
    - Fix C# intellisense will not works after scripts are renamed in Unity Editor.
    - Fix solution file have little chance cannot be found by Omnisharp when project start.
    - Fix go to location from Search Window will be failed when there are no files opened.

    Here is a video for the preview of markdown preview feature:

     
  2. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Version 1.0.9 is available on Asset Store now.
     
  3. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    40% SALE Will be end in next few days (about 2018.8.17) and the new version 1.1.0 will be available on Asset Store. New version will include new features like: Code Actions, Tabs Switch and Syntax Highlighting in Markdown preview.

    Some preview screenshots below:

    Code Actions
    CodeActions_800.jpg

    Tabs Switch
    Tab Switch.png

    Syntax Highlighting in Markdown preview
    Markdown-SyntaxHighlight_800.jpg
     
  4. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Version 1.1.0 is submitted to Asset Store and price have changed to normal ($39.99) in this submittion.

    NEW:
    - Add Code Action Feature for C#.
    - Add tabs navigation.
    - Add user snippets support for C# and Shaderlab. Execute `Config User Snippets...` Command in Command Palette for more details.
    - Improve Markdown previews by adding syntax highlighting for code and able to remember last opened position after tab switched.

    Improvements:
    - Improve menu style and settings window layout.

    Bug Fix:
    - Fix open file outside project failed sometimes.
    - More drop down menu auto hide when mouse don't hover on it.
     
  5. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    V1.1.0 is available on Asset Store now.
     
  6. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Next release will include CodeLens feature for references.

    codelens.png
     
  7. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Version 1.1.1 is submitted to Asset Store.

    NEW:
    - Add CodeLens for references information.
    - Double click on tab list bar will create new file.
    - Add `Config Script Templates...` command to support script template modification for current opened Unity Editor.
    - About window and Settings window can be opened via commands in Command Palette now.

    Improvements:
    - Recently opened files will show on the top of `Go To File` list.
    - Support open multiple files via `Open In uCodeEditor` menu items in Project.
    - Packages size optimization.

    Bug Fix:
    - Tabs closing will not handle dirty state of file.
    - Open file failed when file path contains # symbol.
    - Fix duplicated code action items when select multiple code lines.
     
  8. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    V1.1.1 is available on Asset Store now.
     
  9. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Split Window feature is under development, here is a preview screenshot:

    splitwindow.png
     
  10. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    V1.1.2 was submitted to Asset Store, below is the release note:

    ### 1.1.2

    NEW:
    - Add multiple windows supports. We can create new window using `New Window` command or click the `New Window` menu item in more drop down menu.
    - Add new light theme named `Github`.
    - Add `Open MSDN Documentation for Selection` and `Open Unity Documentation for Selection` commands to search selected text on MSN documentation and Unity script documentation.
    - Add syntax highlighting for SQL and Typescript language.
    - Add `Save File To..` command which can save a copy of current opened file to the location outside project.

    Improvements:
    - Update more dropdown menu style with groups.
    - Add loading image when uCodeEditor window is launching.
    - Add search commands and remove keybinding for a command features in shortcut customization window.

    Bug Fix:
    - Fix AutoSave are broken in some scenarios.
    - Fix `Close` icon is missing in Find References window.
    - Fix issue that folding state cannot restore when tab switched.
    - Fix Go To Definition will not save view state of preview tab.
     
  11. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    V1.1.2 is available on Asset Store now.
     
  12. OnePlusOneNS

    OnePlusOneNS

    Joined:
    Nov 18, 2013
    Posts:
    7
    Amazing asset. Been now using it daily for the past week and it really does feel like VSCode, which I like for being lightweight but effective! :)
    However I do have one issue. The editor seems to fully replace or override the editor choice in unity. Sometimes I do wanna switch to a full IDE (Visual Studio Community or Rider). Is there something I am doing wrong? When I try to switch it in the preference the editor just gets stuck for a few seconds when activating the dropdown. After that the dropdown does not even open and stays on MonoDevelop.

    Other than that an amazing tool. I do feel like scripts shoot out the ground a lot quicker now. :D
     
  13. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Hi,

    That is by design behavior for now. If we need to switch to other IDE, we need to comment out the below line in file OnLoad.cs

    Line 41:
    Code (CSharp):
    1. SetDefaultScriptEditor();
    Line 305:
    Code (CSharp):
    1. [OnOpenAssetAttribute(0)]
    and then select the Full IDE in preference and recompile scripts.

    For the next, may be I can add a preference item to turn it on or off? not sure it's good design or not for now. :)
     
  14. OnePlusOneNS

    OnePlusOneNS

    Joined:
    Nov 18, 2013
    Posts:
    7
    Ah alright I see! Thanks! :)

    I think adding an option in the preferences would definitely help with this. If its the best design choice, not sure.
    Alternatively adding it to the uCodeEditor Settings? Maybe a new tab with something like global settings. Although I think that is not the best place for it. Definitely not an easy choice. :D

    Thanks again for the answer!
     
  15. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Yes, not sure that too. Adding to uCodeEditor Settings maybe a better one, because it's the place for settings.
     
  16. OnePlusOneNS

    OnePlusOneNS

    Joined:
    Nov 18, 2013
    Posts:
    7
    Hey,

    still using the asset almost daily. Really enjoying it :). Another feature that I think would benefit this asset is a visual auto line break. So basically once you reach the end of the window (or a fix value) it visually breaks the line and uses the line below to display the rest.
    I dunno if it is possible, in Visual Studio Code you have no option for it, if I remember correctly (there is probably an extension for that).
     
  17. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Thank you for the idea. I have search VSCode extension marketplace and did find the extension you mentioned. May I ask you for more detail for the visual auto line break? Do it just like the line break in Microsoft Word?

    break.png
     
  18. OnePlusOneNS

    OnePlusOneNS

    Joined:
    Nov 18, 2013
    Posts:
    7
    Not sure about microsoft word. Once you reach the end of the window and you keep typing it just breaks the line, but only visually. In Visual Studio Community a small blue arrow is added to that line, just like the image you posted. Also on the left side the line count skips a line. See the image.

    The arrow on the right is a bit hard to see.

    If it doesnt work using the size of the window, maybe a fixed char/column count could work within the settings. If you have anymore questions just ask. :)
     
    Amlovey likes this.
  19. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    That’s interesting. I will investigate and try to implement it if possible. Thank you:)
     
    OnePlusOneNS likes this.
  20. LudumCor

    LudumCor

    Joined:
    Nov 11, 2016
    Posts:
    8
    Is this asset working also with 2bit characters(for example: Japanesあいうえお).?
     
  21. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Yes, see the below screenshot.

    dbcs.png
     
  22. LudumCor

    LudumCor

    Joined:
    Nov 11, 2016
    Posts:
    8
    Thank you for the immediate reply.
     
  23. rawna

    rawna

    Joined:
    Aug 13, 2015
    Posts:
    35
    Hi

    So I've bought this asset for a few months now, but just got to use it for the past couple of weeks. If you want to know what I think, just read my review which I just posted (In short: it's awesome)

    So now I have a few questions and requests that I hope you could help me with

    1- It seems that whenever I edit any file, it changes the encoding to UTF8 With BOM, and this causes a problem with some json parsers, is there anyway I can disable this behavior or at least manually change the encoding?

    2- There's a setting in vscode called "editor.trimAutoWhitespace", and it's the first setting I uncheck when installing vscode in a new machine. I tried manually adding it to a ucsettings file and importing it, but it didn't work. can you surface it anywhere in the settings screen or when importing a ucsetting file

    3- Is there anyway through some API to find the current file that is being edited in the active tab. I have a workflow where I create csx files and run them in the editor, currently I would right click the csx file in the project pane and click some context menu item to run it. What I would prefer is to have a keyboard shortcut that would run the file that I'm editing without having to leave the editor window, and for that I would need to find, through code, what is the active file in the editor

    4- Speaking of shortcuts, Unity is releasing a new shortcut API in 2019.1. Would you consider using it for the editor shortcuts, as that would fix all the conflicting shortcuts problems, and would allow the users to easily remap anything they don't like


    Again thank you for this great asset, I feel like it deserves way more attention
     
    Amlovey likes this.
  24. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Hi @rawna,

    Thanks a lot for review. For your questions:

    #1. I will try to add encoding config in UCE. For now, may I ask you try modify the file WebviewComService.cs at line about 291 from

    Code (CSharp):
    1. File.WriteAllText(filePath, content, Encoding.UTF8);
    to

    Code (CSharp):
    1. Encoding utf8withtouBom = new UTF8Encoding(false);
    2. File.WriteAllText(filePath, content, utf8withtouBom);
    And see if it works or not?

    #2. UCE does not support that feature for now, but I can add it in later release.

    #3. There are no stable API for these one, but you may try to get current opened file in local settings file as below code show
    Code (CSharp):
    1. [UCommand("uce.getcurrentOpenFile", "Get File")]
    2. public class GetCurrentOpenFile : UDynmaicCommand
    3. {
    4.     public override void Run()
    5.     {
    6.         if (!MainWindow.LastActiveInstance)
    7.         {
    8.             return;
    9.         }
    10.  
    11.         var id = MainWindow.LastActiveInstance.id;
    12.         var localSettingsFile = LocalSettings.GetLocalSettingFileById(id);
    13.         Debug.Log(System.IO.File.ReadAllText(localSettingsFile));
    14.     }
    15. }
    it will register a command named 'Get File' in Command Palette (we need put the code in a script file under Editor folder and restart UCE after recompiling). The command will get the content of local setting file. And the local setting file has a property named 'CurrentActiveFile', which is the current opened file.

    But there are still have bugs in this solution, if we get wrong value, click another tab in UCE and switch back will fix that. And I will add an API to get current opened file in next release.

    #4, I will try that and see how it's going :)
     
  25. rawna

    rawna

    Joined:
    Aug 13, 2015
    Posts:
    35
    Thanks for the quick reply

    #1 That did it, I also tried removing the third parameter like so
    Code (CSharp):
    1. File.WriteAllText(filePath, content);
    and that also worked fine

    #3 Yup, I'm able to find it, but as you said it doesn't update if you open the file through the project pane, it works fine if you switch tabs or use the "Go to file" command.


    Also forgot to mention, occasionally when I create a new c# file through unity, omnisharp doesn't recognize it (no intellisense). So I have to restart omnisharp for it to work. I am not able to reproduce this consistently, and its no big deal since I can easily fix it, but I just thought I'd let you know

    Thanks again, and keep up the good work
     
  26. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Hi @rawna,

    Just want to let you know there is a API named EditorExtensions.GetCurrentOpenFilePathInActiveEditor() in new version 1.1.5 which is stable. You may try this one for your run csx file command.
     
  27. rawna

    rawna

    Joined:
    Aug 13, 2015
    Posts:
    35
    @Amlovey Thanks a lot

    The only issue I found so far is, if the editor (uCodeEditor not unity editor) is not open, and you double click a file to open it, then EditorExtensions.GetCurrentOpenFilePathInActiveEditor() returns the last file that was open before you closed the editor instead of the file that you double clicked.

    other than that, it's pretty great. I also added a command palette's command for it with the shortcut F5, and I love it. can't recommend it enough.
     
  28. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    Hi,
    Its support debug?
     
  29. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    I will try to fix that in next release, thank you for feedback :)
     
  30. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Unfortunately, no for now.
     
    TechnicalArtist likes this.
  31. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    30% OFF SALES for 2 weeks is available now ~~ and version 1.1.8 also released.
     
  32. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Hello, just purchased to try this out, is there a way to get members to display as soon as you typed period or dot? (As in ".")
    Like Intellisense does.
     
  33. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Hello, Intellisense should works. Which os and unity version are you using?
     
  34. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Windows 10, Unity 2019.1.3f1

    In my case, no member suggestion appear when I pressed period/dot (As in "."), it only works when I start typing the first character. Is there a setting I am missing?
     
  35. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Thank you for your information. Seems like Intellisense was broken. May I ask you share me the Ominsharp error log? We can get the log via the command `Omnisharp: Get error log` from command palette.

    If you encounter .net v4.7.1 issue, install the follow pack will fix the issue: https://www.microsoft.com/en-us/download/confirmation.aspx?id=56119
     
  36. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Error Log :
    Code (CSharp):
    1. {"Event":"log","Body":{"LogLevel":"ERROR","Name":"OmniSharp.MSBuild.ProjectLoader","Message":"The reference assemblies for framework \".NETFramework,Version=v4.7.1\" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend."},"Seq":24,"Type":"event"}
    Issue is fixed after installing the pack.

    Thank you!

    I have a suggestion, is it really necessary for uCode Editor to heavily rely on Omnisharp this way? Its pretty heavy in the project. (64MB in size), and it will require me to install this external tool to use uCode Editor. I'd prefer if it will "Just work" without any additional installation like Script Inspector 3 (Which is only 2MB in size). Even if Omnisharp is included with uCode Editor package. Having to install external tool also won't allow me to easily work on another computer with Unity Collab, as I would need to also install Omnisharp on the other computer. (No simple portability)

    Though, functionality wise, uCode Editor is far stronger than SI3 for now. But when SI3 will catch up (It will be slow, but steadily it will), I franky feel like I would switch back to SI3. I hope this will be improved in the future! Because I personally like uCode Editor's interface a lot more!
     
  37. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Thank you for suggestions. Omnisharp is the C# core feature provider in uCodeEditor design, it's not easy and will cost much effort to remove it and then create another smaller C# core features provider which has same facilities.

    The good news is that Omnisharp installation only require one time on same machine. We can remove the Omnisharp packages (all files under the folder: Assets/uCodeEditor/Data/Omnisharp ) in the project after installation. After Omnisharp packages removed, uCodeEditor will only 5MB in size.
     
    Gekigengar likes this.
  38. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Understandable, though, I still feel like this is the only weakness I found for the asset.

    Anyways, after using it a while, I've been getting this warning.
    Code (CSharp):
    1. Assets\uCodeEditor\Editor\Core\OmniSharpManager.cs(144,13): warning CS0162: Unreachable code detected
     
  39. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Good catch. I have disable the warning in my local side, the fix will be in next release
     
  40. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Using Unity 2019.1.3f1

    When I undock the uCodeEditor tab, and docks it back again, the editor freezes blank.

    And is there a way to move/swap/scroll the uCodeEditor script tabs? when it get to the edge of the screen, I can't scroll to left/right to select the obstructed script tab.
     
  41. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    I test it and the blank issue is introduced in Unity 2019. I have added an to do item for this one, and wilk fix in next release .

    For tabs, no such feature for now. But how about blow feature as Image show, which can jump to tabs quickly.

    upload_2019-7-24_10-52-26.png
     
  42. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Sure thing, that looks good!

    But a tab drag/drop swap would be more intuitive, like how browser & Unity inspector tab works.

    I would love an option for method parameters & property set "value" also needs to be highlighted.

    There is also a strange case where a Property (UIControllerHook) is highlighted as a class.

    Blue Property.png

    And is there a way to add the Commands from Command Palette to the right click context menu?, I would like commonly used command such as toggle comment block to be included at right click, or some recently used Commands from the Command Palette.
     
    Last edited: Jul 24, 2019
  43. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    The highlight issue is a known issue. If the first chars of property is upper case, it will highlight as class in that case.

    For add commands to context menu, there are no such feature for now, but it should be possible to do that. I have added a todo item for this.
     
    Gekigengar likes this.
  44. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Hi Gekigengar,

    new version 1.1.9 is available on Asset Store now. Two main updates for this version:

    1. Fix the dock issue on Unity 2019
    2. Able to add context menu item on the right click context menu of editor. Below is a sample:

    Code (CSharp):
    1. [UContextMenuCommand("uce.command.test", "Test: Toggle Command Line", 0, "Test", uCodeEditor.KeyCode.CtrlCmd | uCodeEditor.KeyCode.KEY_P)]
    2. public class TestConextMenuCommand : UDynmaicCommand
    3. {
    4.     public override void Run()
    5.     {
    6.         EditorExtensions.ExecuteAction("editor.action.commentLine");
    7.     }
    8. }
    The UContextMenuCommand is the new attribute to add context menu item.
     
    yomilonge and Gekigengar like this.
  45. yomilonge

    yomilonge

    Joined:
    Aug 18, 2019
    Posts:
    5
    Hi I'm thinking of purchasing your editor.
    Does it support C# 6, i.e. .Net 4.7 features like

    Code (CSharp):
    1. obj?.SomeMethod();
    I currently use Si3, which doesn't, and this is forcing me to have to modify my code.


    so if you support the more up-to-date features in C#, then I'll purchase it
     
    Last edited: Aug 19, 2019
  46. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    I just test it syntax on Unity 2018.3 with scripting runtime version is v4.x equivalent and it works, but does not work if the scripting runtime is 3.5 or older. And do you have any other features about C# 6.0 want to check?

    屏幕快照 2019-08-19 18.05.08.png
     
    yomilonge likes this.
  47. yomilonge

    yomilonge

    Joined:
    Aug 18, 2019
    Posts:
    5
    Now, that's what I call great support :).
    i'm about to purchase it. I sent you a mail about 7 minutes ago
     
  48. yomilonge

    yomilonge

    Joined:
    Aug 18, 2019
    Posts:
    5
    Hi AM
    Good news, I purchased the asset, but I'm having a slight urgent issue.
    I will email you directly
     
    Last edited: Aug 19, 2019
  49. yomilonge

    yomilonge

    Joined:
    Aug 18, 2019
    Posts:
    5
    Hi AM

    I'm on 2018.4.2f1, on windows 8.1, x64

    I just installed it. Some issues but overall a good asset.
    1. "Find all references" is not working. It always shows empty.
      upload_2019-8-19_13-9-19.png
    2. CodeLens also not working, even though I've restarted unity a few times.
    Some nice to haves
    • I do miss being able to drag files between tabs, but I guess I can make-do with retyping the name on the tab I want.
      Not sure how difficult (or messy) it would be to have a [Send To Tab #] option in an [Other Tabs] menu-item.
    • Rather than having the same font size for all tabs, it is possible to set them per tab.
      I have two 27 inch monitors, but with different resolutions. (2560 x 1440) & (1920 x 1080).
      Having this option, will allow me to have a very similar text on both monitors, and will be a very welcome addition.
      I'm absolutely sure that there are other people in my boat which will like this.
    Otherwise, so far, so good.
    I'll write my review at the end of the week
     
  50. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Clicking "Show Generated Codes" on Shader Graph nodes would result in an error when uCodeEditor is the default code editor.

    Can uCodeEditor support this?