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

Exclude file ext from initial selection when renaming a file. #7209

Merged
merged 1 commit into from
Mar 18, 2014
Merged

Exclude file ext from initial selection when renaming a file. #7209

merged 1 commit into from
Mar 18, 2014

Conversation

Robo210
Copy link

@Robo210 Robo210 commented Mar 16, 2014

This change performs the rename as usual through JSTree, then
grabs the DOM node and adjusts the selection on it after the fact.
This fixes issue #7019

This change performs the rename as usual through JSTree, then
grabs the DOM node and adjusts the selection on it after the fact.
This fixes issue #7019
@zaggino
Copy link
Contributor

zaggino commented Mar 17, 2014

Initial review done, works & looks fine.

@ingorichter
Copy link
Contributor

@zaggino could you please finish this review and when you are done please merge. Thanks.

_projectTree.jstree("rename");
var indexOfExtension = escapedName.lastIndexOf('.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be first index of "." instead? If I have e.g. "foo.css.erb" I'd just want to rename the "foo" part.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When renaming files like less-1.4.2.min.js, usually only the last part is considered an extension.

@zaggino
Copy link
Contributor

zaggino commented Mar 18, 2014

Ignore comment, good to merge. My blind self.

zaggino added a commit that referenced this pull request Mar 18, 2014
Exclude file ext from initial selection when renaming a file.
@zaggino zaggino merged commit 8670907 into adobe:master Mar 18, 2014
@zaggino
Copy link
Contributor

zaggino commented Mar 18, 2014

@peterflynn - this could be done as a separate PR because it's a bit more complicated. Should we search the languages.json for known extensions that have . in them and use this for selecting?

@peterflynn
Copy link
Member

Seems plausible, but I don't know if we have to get that fancy. Your argument above sounded reasonable enough to me -- let's wait & see if we get any feedback about it?

@Denisov21
Copy link
Contributor

Hi,
I think it works well now. I share the opinion on "foo.css.erb" is only the extension *.erb. Thanks for the work guys!

@zaggino
Copy link
Contributor

zaggino commented Mar 18, 2014

I don't know - I realized I like the fancy idea and also implementation was just a few lines so I made up a PR and I'll leave to others to merge or not to merge :)

@zaggino
Copy link
Contributor

zaggino commented Mar 18, 2014

Btw @peterflynn we do not longer use doublequotes " for strings?
I don't see any "quotmark": "double" in https://github.com/adobe/brackets/blob/master/.jshintrc but I remember I was told to do that before.

@peterflynn
Copy link
Member

@zaggino Ah, yes -- all JS code should use double-quoted strings (per style guide). So the string in the lastIndexOf() call here should be fixed. Could you roll that into your PR?

@zaggino
Copy link
Contributor

zaggino commented Mar 18, 2014

Already did that for PR. Also tried using "quotmark": "double" in JSHint and it blew out a lof of ' usage, especially in test/ but also 20 or so in src/

@peterflynn
Copy link
Member

Seems worth fixing the ones in src at least, though not high priority...

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

Successfully merging this pull request may close these issues.

5 participants