[TxMt] Re: untitled files not getting fileType setting for the targeted directory

Curt Sellmer sellmerfud at gmail.com
Mon Aug 8 16:53:00 UTC 2016


On Sun, Aug 7, 2016 at 11:24 AM, Allan Odgaard <mailinglist at textmate.org>
wrote:

> While I thought I understood what you meant (previous reply), I seem
> unable to actually reproduce that (i.e. creating a [ templates/** ] with
> fileType and tabSize works when creating file via file browser, mate, or
> ⌥⌘N for then templates is the project folder).
>
> Can you reformulate this issue in “steps to reproduce” with
> expected/actual result?
>

​OK, I put some time into this and here is what I have found.
I set up a project directory with two subdirectories called src and
templates.
Then I created a .tm_properties file in the project directory that contains:
[ src/** ]
fileType  = 'source.ruby'

[ templates/** ]
fileType  = 'text.html.basic'


1. When I select a directory in the file browser and the selected directory
is not open (ie. the triangle is pointing to the right) and press ^⌘N the
file is created not in the selected directory but as a sibling to the
selected directory.  Perhaps this is by design?  So it does not get the
assigned type because it is in a different directory.  If I configure a
type for the parent directory it correctly gets assigned.  Good.

2.  When I select a directory in the file browser and the selected
directory is open (triangle points down) and press ^⌘N, the file is created
in the selected directory and is assigned the correct type. Perfect.

3. When I select a directory in the file browser and press ⌥⌘N, (regardless
of whether the directory is open or closed) I always get an untitled
document with type 'text.plain'.   When I subsequently save the file it
correctly goes into the directory that was selected.

- Seems inconsistent that the open/close state of the directory affects one
operation but not the other.
- I'm guessing that with ⌥⌘N the file type is not being assigned because
the untitled doc does not yet actually
exist in the directory.  But since TextMate knows where it will be saved,
perhaps the logic could modified so that this works?
- For now the workaround is to make sure the directory is open in the file
browser and use ^⌘N.

Hope this helps.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20160808/f63bd89f/attachment.html>


More information about the textmate mailing list