Menu

Filename extensions when saving

HappyDog
2007-07-05
2012-11-13
  • HappyDog

    HappyDog - 2007-07-05

    If I create a new file in Notepad++ and save it, the save dialog does not respect, nor remember, the file type used.

    For example, if I enter the name "my file" and click 'save' when the 'Save as type' box contains "Normal text file (*.txt)" I would expect the resulting file to be called "my file.txt", rather than simply "my file".

    The box should also remember the last selected file type whenever it is opened (currently it always defaults to 'all').  The exception to this is when saving an existing file under a new name, where it should default to the current file type.  Therefore saving "Test.txt" as "My new file name" results in a saved file called "My new file name.txt".

    This is standard behaviour for most editing programs I have used - could it be implemented here too?

    - Mark

     
    • Nobody/Anonymous

      Oups, nevermind

      Oh, I've just noticed that I used npp v4.4,
      I've downloaded v4.5 and installed it, the pb appears to be resolved
      I can now edit my VBS with keeping the extensions... GREAT :oD

      Regards

      Garulfo

       
    • HappyDog

      HappyDog - 2007-07-05

      Addendum: I did consider that the file type should be linked to the language, and this is another possibility, but this will result in all files defaulting to *.txt (or whatever default language you have chosen), rather than the most recently used type. 

      If you went down this route, here's the logic of how I would expect it all to work:

      When the 'save' (or 'save as...') dialog is opened:
      1) If the file already exists, set the 'File Type' to the current file extension.
      2) If it is a new file and the language has been explicitly set (i.e. changed from the default) then use the extension associated with this language.
      3) If it is a new file and the user hasn't explicitly specified a language, use the LastSaveType.

      How/when LastSaveType should be set:
      4) LastSaveType should default to the extension for the default language when the program is first installed (.txt, I believe).
      5) Whenever the user manually changes this it should be set to the value they chose.  This should happen even if they cancel the dialog (I think).
      6) If the default file type is chosen using point (1) then LastSaveType should _not_ be updated (unless the user manually changes it).
      7) If the default file type is chosen using point (2) then I am not sure whether LastSaveType should set updated or not.  Probably not, but I can see an argument for doing so.

      LastOpenType - the equivalent for the open dialog:
      8) LastOpenType should be a separate variable, only used in the open dialog.
      9) The rule for this is very simple - whenever the user changes the filter, it is stored in this variable.  The default setting (when the program is installed) should probably be 'all'.

      Anyway - that's just a bit of a brain splurge about how I would expect this to work.  I would be interested to hear your thoughts about this and whether it is something that is likely to be implemented at all (even if not in this manner)?

      Either way, thanks for all your work on this great bit of software!

       
      • HappyDog

        HappyDog - 2007-10-15

        Thanks a lot for adding this functionality!  I haven't tested it fully, so I don't know how closely it mirrors my suggestion, above, but it certainly seems to cover the most important cases.  Thank you so much!

         
    • Greg Bullock

      Greg Bullock - 2007-07-05

      Fine suggestions, all.  At a minimum, I agree with you that when no extension is supplied explicitly in the Save dialog, and the file name doesn't end in a period either, then the extension should be inferred and supplied automatically from the File Type list.

      Keeping LastSaveType and LastOpenType as you describe would be an additional, and most welcome bonus.  I wouldn't even complain if they were both merged into a single LastOpenSaveType, updated by both the Open and Save dialogs according to rules (5)-(7) and (9), but that would certainly complicate the question of what should be the default.  Keeping them as separately stored variables, as you suggest, is a further improvement, in my opinion.

      Regarding rule (5), personally I'd lean toward letting Cancel make no change to LastSaveType.

      Regards.
      Greg

       
      • HappyDog

        HappyDog - 2007-07-05

        I think it would be most useful to keep the settings separate.  For example, I will most often be saving the same file type (*.php), but will probably want to browse through all files (*.*) when opening files.

        Re: rule 5 - yeah, on reflection, you're probably right about that.

        - Mark

         
    • Nobody/Anonymous

      Fine ideas all. Great reasoning, but you will not get any response or resolution of this issue. They are stonewalling it for some unknown reason. They will not even say "yes" this is a good idea or "no" it is not a good idea. I have tried three times to suggest an even a more simplified solution to this "bug". They told me I was "whining". Ever other program I have can provide this functionality. Why can't Notepad++? Maybe this will spur them on to accomplish littler things that are meaningful. I wouldn't hold my breath waiting for a response or resolution. Good Luck!

      Bob

       
    • Nobody/Anonymous

      I want to thank whomever added the functionality to the Save as Save dialog. It makes Npp a great editor.

      BOB

       
    • Nobody/Anonymous

      Is there any way of adding .dtd to the save as list?

       
      • Nobody/Anonymous

        Hi,
        First, I want to thank whomever implemented the Save as functionality to Npp.
        It is
        a huge step forward to a great editor.
        Secondly, you can please all the people all of the time. One of my solutions
        should resolve the issue (I think). In preferences, add a tab where anyone can
        add their favorite extensions (including customized). Say, twenty or thirty
        (including null or spaces). When a person saves a file load in his or her extensions.
        This leaves it up to the USER to decide how this functionality should work.
        If you're using a table to save the extensions, load them into an array in memory,
        at startup, and then load them from the array. This should stop the thrashing
        of constantly calling the database to get the extensions. The array will be
        in memory, so should be fast loading. I think this will work. If your going
        in to make changes anyway, you could do this instead of taking out functionality
        and putting different functionality in. It could even cut down on your coding.
        I think you are more than half way there already.

         
    • Nobody/Anonymous

      Well, I have an issue with this functionnality...

      When I open a VBScript (extention like ".vbs") npp detects language "VB"...
      That's ok, but ...
      When I want to save my file, npp REPLACE the .vbs extension by a .vb
      Event if I type myself the full name with the extension : test.vbs is REPLACED by test.vb
      So, each time I need to save, I have to
      Save in npp and quit
      go in explorer to delete old vbs file
      rename file.vb in file.vbs

      That drives me crazy :o(

      I find nowhere the way to say "EXTENSION FOR VB IS VBS NOT VB"  >:( in any menu...
      Could I do that in xml files or somewhere else ?

      Regards

      Garulfo