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

Clean up dependencies in brackets.js #10596

Merged
merged 3 commits into from
May 20, 2015

Conversation

marcelgerber
Copy link
Contributor

For case 2 of #1783.

@marcelgerber marcelgerber changed the title Brackets js dependencies Clean up dependencies in brackets.js Feb 14, 2015
CodeInspection : CodeInspection,
CommandManager : CommandManager,
Commands : Commands,
CodeHintManager : require("editor/CodeHintManager"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why another require is preferable? Does it solve any issue at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the require above since we should only require module over there that we actually need in our code, for example for calling their methods.
The only occurence of CodeHintManager, though, is here in brackets.test.

See #1783 (case 2) for more details.

Copy link
Contributor

Choose a reason for hiding this comment

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

It does not quite explain all the changes. LanguageManager is loaded twice via require, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I see. This PR is 3 months old, so I don't exactly know the initial motivation, but I think it might be that this just looks cleaner to me, than having a mixture of requires and variable references.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK. Now I see. Not going to argue aesthetics. It may improve readability for this one case, but I prefer variables since they can be linted and not get back at you at runtime. Technically, there's a negligible difference and the code is executed once. So if you want to, you can merge it with master and we can merge it back in. If not, let's close it.

@marcelgerber marcelgerber force-pushed the brackets-js-dependencies branch from 7ed8f5e to fbf6d92 Compare May 14, 2015 08:28
@marcelgerber
Copy link
Contributor Author

@busykai Merged with master.

@busykai
Copy link
Contributor

busykai commented May 14, 2015

@marcelgerber, it works OK. The only comment I have is: I'd also move the CodeMirror load/global def lines 104-114 to before line 47 (right before all the CodeMirror plugins are loaded). First of all, these lines create a global; secondly it makes sense (for readability) to load the module itself before loading its plugins. Tried the change, it causes no problems. Does it make sense to you?

@marcelgerber
Copy link
Contributor Author

The issue with that is, though, that these lines need DeprecationWarning, which is defined later on (and thus causes a JSLint error).

The only thing we could do is load CodeMirror before line 47 and then create the global, deprecated object afterwards, but that would then be out of context.

@busykai
Copy link
Contributor

busykai commented May 18, 2015

@marcelgerber, you're right. However, I think we could well load DeprecationWarning at the very beginning (using separate var). It's a utility and does not really belong among other "functional" modules. What do you think?

@marcelgerber
Copy link
Contributor Author

I'm not too fond about that. We've pretty much always kept the requires in one block and I don't like the idea of making an exception just for this module.

@busykai
Copy link
Contributor

busykai commented May 20, 2015

@marcelgerber, ok! This looks good to me. It solves the purpose that you outline in the PR description. Merging.

busykai added a commit that referenced this pull request May 20, 2015
@busykai busykai merged commit 19f9b43 into adobe:master May 20, 2015
@marcelgerber marcelgerber deleted the brackets-js-dependencies branch May 20, 2015 04:29
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.

2 participants