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

Console error whenever new file is created in project where defaultExtension is set #6539

Closed
njx opened this issue Jan 15, 2014 · 7 comments
Closed
Assignees

Comments

@njx
Copy link
Contributor

njx commented Jan 15, 2014

  1. Trash prefs
  2. Launch Brackets
  3. Cmd-N to create a new file in the Getting Started project
  4. Open dev tools and look at the console

Result: Error resolving /_brackets_83937217/ at ScopeManager.js:1071.

@peterflynn
Copy link
Member

This is happening because ScopeManager doesn't support untitled documents. Before #6428 it was never exposed to such documents, they never had a file extension and thus were never seen as JS content.

@iwehrman and I spent some time trying to fix ScopeManager for this case back in the day, and were unsuccessful. So for now I think we need to stick with simply treating these files as not JS. I can think of a few quick fixes:

  • Turn off the "defaultExtension" preference entirely
  • Leave it enabled, but refuse to accept any extensions that would map to the JS language (would probably be confusing for users)
  • Leave it enabled, and accept all values, but force LanguageManager to always return plain text for untitled documents (would still be somewhat confusing, since there'd be no code coloring until you save; might be a bit messy to implement; and not quite 100% guaranteed to avoid all the ScopeManager bugs)
  • Audit all the places that ScopeManager checks whether a document is JS, and add a second check for whether it's untitled -- this would mean the file would be code colored as JS but you wouldn't get any code hints until save (nicer behavior, but maybe still a bit confusing)

@njx
Copy link
Contributor Author

njx commented Jan 15, 2014

This appears to be happening even in projects where defaultExtension isn't set, though.

@njx
Copy link
Contributor Author

njx commented Jan 15, 2014

Ah, I forgot that Getting Started is in the brackets folder, which does set the pref. Updated title.

@ghost ghost assigned bchintx Jan 16, 2014
@peterflynn
Copy link
Member

Assigning to @bchintx since his PR #6543 addresses this

peterflynn added a commit that referenced this issue Jan 16, 2014
@peterflynn
Copy link
Member

So we've done the first bullet for now -- removing support for this pref entirely. I'm leaving this bug open to track doing either one of the nicer fixes listed above, or actually fixing the underlying ScopeManager problems so it can be fully re-enabled. (The latter would also unblock #6409, but it may be a backlog-sized chunk of work).

@njx
Copy link
Contributor Author

njx commented Jan 16, 2014

Should we close this one since the symptoms are fixed, and open a separate code cleanup bug on the desired improvements?

@dangoor
Copy link
Contributor

dangoor commented Jan 17, 2014

@njx yeah, that was my thinking. I opened #6559 to get the preference in working order. I wasn't sure if ScopeManager was the only thing that is unhappy with untitled files of a certain type. (Actually, we'll want to fix that anyhow at some point since we want users to be able to select the mode for the current file...)

Now that the immediate symptoms are gone, I'll close this and use #6559 to track the final implementation

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

No branches or pull requests

4 participants