Web Inspector: highlight backend languages as scripts
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Jan 2013 14:05:06 +0000 (14:05 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Jan 2013 14:05:06 +0000 (14:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108336

Reviewed by Vsevolod Vlasov.

Most languages have structure similar to js, so enabling default highlighter for them won't hurt.

* inspector/front-end/FileSystemWorkspaceProvider.js:
(WebInspector.FileSystemWorkspaceProvider.prototype._contentTypeForPath):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141411 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/FileSystemWorkspaceProvider.js

index c1c9b9c..b4f98e4 100644 (file)
@@ -1,3 +1,15 @@
+2013-01-31  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: highlight backend languages as scripts
+        https://bugs.webkit.org/show_bug.cgi?id=108336
+
+        Reviewed by Vsevolod Vlasov.
+
+        Most languages have structure similar to js, so enabling default highlighter for them won't hurt.
+
+        * inspector/front-end/FileSystemWorkspaceProvider.js:
+        (WebInspector.FileSystemWorkspaceProvider.prototype._contentTypeForPath):
+
 2013-01-31  Andrey Adaikin  <aandrey@chromium.org>
 
         Web Inspector: [Profiles] show launcher view upon deleting last profile type's header
index 5a599bf..57e15d0 100644 (file)
@@ -44,6 +44,8 @@ WebInspector.FileSystemWorkspaceProvider = function(isolatedFileSystemModel)
     this._isolatedFileSystemModel.mapping().addEventListener(WebInspector.FileSystemMapping.Events.FileSystemRemoved, this._fileSystemRemoved, this);
 }
 
+WebInspector.FileSystemWorkspaceProvider._scriptExtensions = ["js", "java", "cc", "cpp", "h", "cs", "py", "php"].keySet();
+
 WebInspector.FileSystemWorkspaceProvider.prototype = {
     /**
      * @param {string} uri
@@ -120,7 +122,7 @@ WebInspector.FileSystemWorkspaceProvider.prototype = {
         if (extensionIndex !== -1)
             extension = fileName.substring(extensionIndex + 1);
         var contentType = WebInspector.resourceTypes.Other;
-        if (extension === "js")
+        if (WebInspector.FileSystemWorkspaceProvider._scriptExtensions[extension])
             return WebInspector.resourceTypes.Script;
         if (extension === "css")
             return WebInspector.resourceTypes.Stylesheet;