Giter VIP home page Giter VIP logo

Comments (29)

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024 2

Thank you everyone for raising the issue and helping resolving it. New release is live https://github.com/alexsorokoletov/VisualStudioMac.SortRemoveUsings/releases

from visualstudiomac.sortremoveusings.

MKuckert avatar MKuckert commented on June 18, 2024 1

No worries! I'm pretty sure the problem has vanished with the latest version of visual studio - I will check that and give you a hands up the end of next week.

from visualstudiomac.sortremoveusings.

cap-dbaronnet avatar cap-dbaronnet commented on June 18, 2024 1

@alexsorokoletov
Here is my project for you to reproduce.
Test.zip

I have also tested the preview but I can not install it (see photo attached)
capture d ecran 2018-01-11 a 10 24 38

from visualstudiomac.sortremoveusings.

cap-dbaronnet avatar cap-dbaronnet commented on June 18, 2024 1

@alexsorokoletov With the new version of Visual Studio it's work fine for me :-)
Thanks you very much !

from visualstudiomac.sortremoveusings.

jschmid avatar jschmid commented on June 18, 2024 1

It works for me too !

Thanks guys for fixing or helping fixing it !

from visualstudiomac.sortremoveusings.

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024

I will update the plugin this week. VS for Mac should have this, agree 100% :)

from visualstudiomac.sortremoveusings.

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024

@MKuckert you can download VS for Mac extension in releases: https://github.com/alexsorokoletov/VisualStudioMac.SortRemoveUsings/releases/tag/1.1

from visualstudiomac.sortremoveusings.

MKuckert avatar MKuckert commented on June 18, 2024

Wow, that was quick 😄

I've installed the extension but it doesn't work correctly. The usings are resorted and optimized on hitting save and the file stays with the changed-indicator (close-button on the tab stays being the circle: image). Thats the same behavior as it was for Xamarin Studio.
Hitting save again results in no changed, but the file is not saved either – the file simply keeps the changed-indicator. Upon compilation VS raises the error The build has been aborted as the file '…DetailViewController.cs' could not be saved.

Seems like VS is behaving differently then XS did when observing the save event?

from visualstudiomac.sortremoveusings.

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024

@MKuckert that might happen. Can you reproduce that on any file or just on this specific?
Would be great if you provide a sample file where you can see that behavior.

Fact is, the extension only calls built-in command to refactor code.

from visualstudiomac.sortremoveusings.

MKuckert avatar MKuckert commented on June 18, 2024

Yes, I can reproduce that on a all files I tested with. Here is a simple sample file:

using System;
using Akavache.Sqlite3;

// Note: This class file is *required* for iOS to work correctly, and is 
// also a good idea for Android if you enable "Link All Assemblies".
namespace Proj.Recipes.Droid
{
    [Preserve]
    public static class LinkerPreserve
    {
        static LinkerPreserve()
        {
            throw new Exception(typeof(SQLitePersistentBlobCache).FullName);
        }
    }


    public class PreserveAttribute : Attribute
    {
    }
}

from visualstudiomac.sortremoveusings.

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024

@MKuckert I've added file to an Android project and installed Akavache Sqlite3 NuGet package. Everything works as expected.

I assume there something else what changes the file before or after save. Can you enable hidden characters in VS4Mac and see if there are any changes when you try to save it.

Btw, without package, when I save the file, 2nd using is being removed since namespace is not recognized.

from visualstudiomac.sortremoveusings.

jschmid avatar jschmid commented on June 18, 2024

I have the same problem as @MKuckert. The change files seem to always be unsaved. There is no way for make VS believe that the file is indeed saved.

from visualstudiomac.sortremoveusings.

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024

@jschmid @MKuckert I'd be glad to have a short video to see the problem. I can't reproduce that issue though I feel fix is simple and I'm just missing something.

Sorry for the long answer, guys

from visualstudiomac.sortremoveusings.

jschmid avatar jschmid commented on June 18, 2024

never-saved

You will see that I scramble the imports manually, then I hit "save". You can notice that the file still appears unsaved in the editor. I have no way to close the file because it always says it's unsaved.

from visualstudiomac.sortremoveusings.

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024

@jschmid it's a known thing that you have to press save sometimes twice since refactoring command changes file after it was saved (at least now it's how it is in the MonoDevelop extension, there is no PreSave). But if you press save again after extension it should allow you to save since there will be no changes (usings are already sorted).

Is it the case?

from visualstudiomac.sortremoveusings.

jschmid avatar jschmid commented on June 18, 2024

@alexsorokoletov Sadly no. I can press as many times as I want, the file always appears as unsaved. It does not change it I use the menu or the keyboard shortcut.

from visualstudiomac.sortremoveusings.

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024

So it's something else then.

@jschmid would you be able to turn on all invisibles (Preferences -> Text Editor -> Markers and Rulers -> Show invisible characters = Always) and reproduce the problem on video on some tiny file where we can see all the content?

Also, wondering if on previous GIF you would enable invisibles, disable the extension and instead save file and then run the context command "Sort and Remove usings" manually.

Idea is that since that o round circle icon shows up, there is something being changed. Some whitespace or line ending or something else.
I can't reproduce that on my mac or any other I can reach :(

Really appreciate your help!

from visualstudiomac.sortremoveusings.

cap-dbaronnet avatar cap-dbaronnet commented on June 18, 2024

Hello,
I have the same problem. Can you fix it because your projet it's very useful ?
Cordially

from visualstudiomac.sortremoveusings.

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024

@damienB if you could follow previous comment for me and see if something is happening with hidden characters?

from visualstudiomac.sortremoveusings.

cap-dbaronnet avatar cap-dbaronnet commented on June 18, 2024

@alexsorokoletov I try with a minimalist class and I still have the problem. I attach a screenshot of the code with the special characters.
capture d ecran 2017-12-27 a 10 02 10

from visualstudiomac.sortremoveusings.

cap-dbaronnet avatar cap-dbaronnet commented on June 18, 2024

@alexsorokoletov
Hello,
Have you found where the problem is coming from?
Thanks,

from visualstudiomac.sortremoveusings.

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024

@damienB I'd be glad, I still can't repro. Let's connect and reproduce it on your system so that I can fix that annoying issue :)

would you be able to turn on all invisibles (Preferences -> Text Editor -> Markers and Rulers -> Show invisible characters = Always) and reproduce the problem on video on some tiny file where we can see all the content?

Also, wondering if on previous GIF you would enable invisibles, disable the extension and instead save file and then run the context command "Sort and Remove usings" manually.

Alternative would be a video or gif of these two scenarios.

from visualstudiomac.sortremoveusings.

cap-dbaronnet avatar cap-dbaronnet commented on June 18, 2024

@alexsorokoletov I think I have found where the problem comes from. When the box "Preferences -> Source code -> Code formating -> C # source code -> Convert tabs to spaces = Checked" it works but if it is unchecked then we have the problem described above (see gif) .

ezgif com-optimize

PS : est-il possible de sauvegarder automatiquement après le trie quand cela fonctionne pour ne pas avoir à sauvegarder deux fois comme sur le gif ?

from visualstudiomac.sortremoveusings.

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024

@damienB looking! Thank you for the gif and research.
Regarding PS, yes I think it is possible to save you from doing it twice ;)

from visualstudiomac.sortremoveusings.

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024

Reproduced, working on a fix

from visualstudiomac.sortremoveusings.

cap-dbaronnet avatar cap-dbaronnet commented on June 18, 2024

@alexsorokoletov Thanks !

from visualstudiomac.sortremoveusings.

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024

@damienB would you be able to zip this sample solution in a state when you can reproduce the problem? VS stores all settings inside .sln.

I might want to double check before I put an update out there.
Here is a preview of the update (needs to be unzipped)
SortAndRemoveOnSave.SortAndRemoveOnSave_1.2.mpack.zip

from visualstudiomac.sortremoveusings.

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024

@damienB I see, recently updated my VS to the latest stable. If you plan to do so anyway - you can update VS and try again. If not - I will rebuild extension for an earlier version later today.

from visualstudiomac.sortremoveusings.

alexsorokoletov avatar alexsorokoletov commented on June 18, 2024

Perfect, I will prepare an update ;)

from visualstudiomac.sortremoveusings.

Related Issues (4)

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.