-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Allow JavaScript Code Hints only in its context #11263
Conversation
@@ -341,10 +341,11 @@ define(function (require, exports, module) { | |||
}; | |||
|
|||
/** | |||
* @return {boolean} - true if the document is a html file | |||
* @return {boolean} - true if the document is a html or php file | |||
*/ | |||
function isHTMLFile(document) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function name is now misleading. maybe change including usages to isHTMLOrPHPFile(document)
or alternatively move the check to a more localized place.
ef98bd6
to
6757007
Compare
@@ -56,6 +56,9 @@ define(function (require, exports, module) { | |||
noHintsOnDot = false, // preference setting to prevent hints on dot | |||
ignoreChange; // can ignore next "change" event if true; | |||
|
|||
// Languages that support inline JavaScript | |||
var _inlineScriptLanguages = ["html", "php"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to define this as a preference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think so. These are the only two languages that support inline JS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case someone wants to disable JavaScript code hints in PHP, they can use language/php layer to disable them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jsp/asp I remember can do similar js mixin as PHP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abose jsp/asp files will be highlighted as html files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe is something that could be defined as part of the language in the LanguageManager?
6757007
to
016e837
Compare
Allow JavaScript Code Hints only in its context
Looks good. Merging. |
Fixes a regression I made in #11245 where JavaScript code hints were globally available in a PHP document. This will make sure they are only available inside
script
tags.