@@ -38,11 +38,24 @@ define(function (require, exports, module) {
3838 JSONUtils = brackets . getModule ( "language/JSONUtils" ) ,
3939 Strings = brackets . getModule ( "strings" ) ,
4040 ThemeManager = brackets . getModule ( "view/ThemeManager" ) ,
41+ CodeInspection = brackets . getModule ( "language/CodeInspection" ) ,
4142 _ = brackets . getModule ( "thirdparty/lodash" ) ,
42- data = JSON . parse ( require ( "text!data.json" ) ) ,
43+ languages = LanguageManager . getLanguages ( ) ,
4344 isPrefDocument = false ,
4445 isPrefHintsEnabled = false ;
4546
47+ // Stores data of preferences used by Brackets and its core/thirdparty extensions.
48+ var data = {
49+ language : {
50+ type : "object" ,
51+ description : Strings . DESCRIPTION_LANGUAGE
52+ } ,
53+ path : {
54+ type : "object" ,
55+ description : Strings . DESCRIPTION_PATH
56+ }
57+ } ;
58+
4659 var stringMatcherOptions = {
4760 preferPrefixMatches : true
4861 } ;
@@ -224,7 +237,7 @@ define(function (require, exports, module) {
224237 if ( data [ ctxInfo . parentKeyName ] && data [ ctxInfo . parentKeyName ] . keys ) {
225238 keys = data [ ctxInfo . parentKeyName ] . keys ;
226239 } else if ( ctxInfo . parentKeyName === "language" ) {
227- keys = LanguageManager . getLanguages ( ) ;
240+ keys = languages ;
228241 option . type = "object" ;
229242 } else {
230243 keys = data ;
@@ -235,7 +248,7 @@ define(function (require, exports, module) {
235248 var match = StringMatch . stringMatch ( key , query , stringMatcherOptions ) ;
236249 if ( match ) {
237250 match . type = keys [ key ] . type || option . type ;
238- match . description = keys [ key ] . description || Strings [ keys [ key ] . string ] || null ;
251+ match . description = keys [ key ] . description || null ;
239252 return match ;
240253 }
241254 }
@@ -257,9 +270,11 @@ define(function (require, exports, module) {
257270 } else if ( option && option . values && ( [ "number" , "string" ] . indexOf ( option . type ) !== - 1 ||
258271 ( option . type === "array" && ctxInfo . isArray ) ) ) {
259272 values = option . values ;
273+ } else if ( ctxInfo . isArray && ctxInfo . keyName === "linting.prefer" && languages [ ctxInfo . parentKeyName ] ) {
274+ values = CodeInspection . getProviderIDsForLanguage ( ctxInfo . parentKeyName ) || [ ] ;
260275 } else if ( ctxInfo . parentKeyName === "language.fileExtensions" ||
261276 ctxInfo . parentKeyName === "language.fileNames" ) {
262- values = Object . keys ( LanguageManager . getLanguages ( ) ) ;
277+ values = Object . keys ( languages ) ;
263278 } else {
264279 return null ;
265280 }
@@ -269,7 +284,7 @@ define(function (require, exports, module) {
269284 var match = StringMatch . stringMatch ( value , query , stringMatcherOptions ) ;
270285 if ( match ) {
271286 match . type = option . valueType || option . type ;
272- match . description = Strings [ option . string ] || option . description || null ;
287+ match . description = option . description || null ;
273288 return match ;
274289 }
275290 } ) ;
0 commit comments