Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Allow setting default file type for files without extension #12766

Closed
3 tasks done
CupOfTea696 opened this issue Sep 9, 2016 · 14 comments
Closed
3 tasks done

Allow setting default file type for files without extension #12766

CupOfTea696 opened this issue Sep 9, 2016 · 14 comments

Comments

@CupOfTea696
Copy link

Prerequisites

  • Can you reproduce the problem with Debug \ Reload Without Extensions?
  • Did you perform a cursory search to see if your bug or enhancement is already reported?
  • Did you read the Troubleshooting guide?

Description

Setting the default language for files with no file extension has no effect.

Steps to Reproduce

  1. Open file with no file extension
  2. Click file-type selector in bottom bar (says "Text" by default for unknown file types)
  3. Select a different file-type (e.g. "Bash")
  4. Reload Brackets or open another file with no extension

Expected behavior: The file-type is Bash and it is syntax highlighting the content

Actual behavior: The file-type is Text and there is no syntax highlighting

Versions

OS X Yosemite
Release 1.7 build 1.7.0-16898 (release b0a363b)

@zaggino zaggino added this to the Release 1.9 milestone Sep 9, 2016
@petetnt
Copy link
Collaborator

petetnt commented Sep 11, 2016

Dupe of #12655 but this one is more meaty so I'll just close the old one 👍

Also see #11560

@petetnt
Copy link
Collaborator

petetnt commented Sep 11, 2016

I made some work on this a while ago but didn't have to finish it yet. See this commit: petetnt@b069d3e

Things that are missing:

  • Following file renames and deletes
  • Unit tests

@alanbares
Copy link

Well been wanting to help with Brackets since it's my usual IDE but not sure if if I can handle this issue. I'll try and give it a shot anyway.

@mpettaw2
Copy link

I would love to work on this issue as well if that's ok.

@petetnt
Copy link
Collaborator

petetnt commented Sep 26, 2016

@mpettaw2 of course! @alanbares have you made much progress? Could you perhaps coordinate together? 👍

@alanbares
Copy link

@petetnt Not really, I feel completely lost tackling the issue :(.

@ficristo
Copy link
Collaborator

@petetnt do we need to land @sprintr PR first?

@petetnt
Copy link
Collaborator

petetnt commented Sep 26, 2016

@ficristo maybe not need for this feature,, but it would be a great addition on it's own and would be a good starting point for this feature too.

@mpettaw2
Copy link

so i found the getFilenameWithoutExtension function. i was going to change that instead of the getFileExtension because I didn't want change the file before it got written to the program. anyway i was thinking of something like

function getFilenameWithoutExtension(filename) {
        var index = filename.lastIndexOf(".");
        return index===-1 ?filename+".bat":filename.slice(0, index);

          /*mpettaw2: will return filename.bat if filename does not have an extension */
    }

just wanted to see if that was ok before i send it out....

@mansimarkaur
Copy link
Contributor

mansimarkaur commented Sep 27, 2016

@mpettaw2 the getFilenameWithoutExtension function return filenames for directories as well and .bat won't be suitable extension for a directory. Also, this method is supposed to return only the filename after stripping the extension (if any), so adding .bat to a file without extension for returning as filename doesn't seem feasible. Please let me know if I'm wrong.

@yogupta
Copy link

yogupta commented Oct 5, 2016

Hello,
I'm new to Open Source. I would like to fix this issue . This is my first time.
Can someone help me get started?

@petetnt
Copy link
Collaborator

petetnt commented Oct 5, 2016

Hi @IncorrectUsername!

That's great! See the article How to hack on Brackets to get started with the Brackets codebase. If you have any questions, feel free to post them here! We also have a Slack channel for day-to-day communication. (You can join by sending a mail to admin@brackets.io with the subject line slack registration request specifying the email addresses you would like to register).

@haslam22
Copy link
Contributor

haslam22 commented Nov 3, 2016

So, a little confused on this issue, by looking at #11560 it seems like the intended behaviour for extension-less files is:

  • Show Set as Default for <filename> Files instead of Set as Default for . Files in the dropdown below
  • Add the file name (or path?) mapping somewhere

Currently what happens is:

  • User opens a file without an extension
  • Selects a language and clicks Set as Default for . Files
  • Preferences update by adding the "" : language mapping to the language.fileExtensions map
  • This mapping is ignored by Brackets when calling getLanguageForPath(), but can be resolved by determining if there is no extension and checking the extensions map for the empty string

Unsure if we need to resolve the mapping being ignored, or if the behaviour needs to be similar to #11560

@AkshayMathur92
Copy link

Why is this bug still open ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests