Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64584

Wrong language for syntax highlighting

    XMLWordPrintable

Details

    Description

      With the added support of translation files the current implementation of language detection isn't anymore enough, as a file extension could be used for different usage. So SourcePrinter::selectLanguageClass always decide that file extension *.ts means typescript, but it could be now also markup (as it as qt translation file). This leads to interesting coloring of the file - and tons of useless html tags

       

      There are different possibilities to fix this:

      • The IssueParser within AnalysisModel could store the language and the WNG plugin matches it to the available prism languages (e.g. xml => markup). So the language decision could be overwritten by the parser
      • Add option in Jenkins settings to adjust the file extension mapping. This could be useful as the mapping is already incomplete (e.g. glsl is supported by Prism, but not by the plugin)
      • Add this options not globally, but per project.
      • Add language auto detection
         

      First option would be a fix without the need the user has to do sth. Second & third has the benefit that further languages could be added. 

      As we have a lot of different jobs for the same project second option would be best for us, but in case Jenkins is used for different projects (e.g. a Qt C++ project and a Typescript project) third option may be better. An combination would also be an option (e.g. create globally different named file mapping and within the call to recordIssue you reference one of the named mapping).

      Attachments

        Activity

          sunblack sunblack created issue -
          drulli Ulli Hafner made changes -
          Field Original Value New Value
          Description With the added support of translation files the current implementation of language detection isn't anymore enough, as a file extension could be used for different usage. So SourcePrinter::selectLanguageClass always decide that file extension *.ts means typescript, but it could be now also markup (as it as qt translation file). This leads to interesting coloring of the file - and tons of useless html tags

           

          There are different possibilities to fix this:
           * The IssueParser within AnalysisModel could store the language and the WNG plugin matches it to the available prism languages (e.g. xml => markup). So the language decision could be overwritten by the parser
           * Add option in Jenkins settings to adjust the file extension mapping. This could be useful as the mapping is already incomplete (e.g. glsl is supported by Prism, but not by the plugin)
           * Add this options not globally, but per project.

           

          First option would be a fix without the need the user has to do sth. Second & third has the benefit that further languages could be added. 

          As we have a lot of different jobs for the same project second option would be best for us, but in case Jenkins is used for different projects (e.g. a Qt C++ project and a Typescript project) third option may be better. An combination would also be an option (e.g. create globally different named file mapping and within the call to recordIssue you reference one of the named mapping).
          With the added support of translation files the current implementation of language detection isn't anymore enough, as a file extension could be used for different usage. So SourcePrinter::selectLanguageClass always decide that file extension *.ts means typescript, but it could be now also markup (as it as qt translation file). This leads to interesting coloring of the file - and tons of useless html tags

           

          There are different possibilities to fix this:
           * The IssueParser within AnalysisModel could store the language and the WNG plugin matches it to the available prism languages (e.g. xml => markup). So the language decision could be overwritten by the parser
           * Add option in Jenkins settings to adjust the file extension mapping. This could be useful as the mapping is already incomplete (e.g. glsl is supported by Prism, but not by the plugin)
           * Add this options not globally, but per project.
           * Add language auto detection
           

          First option would be a fix without the need the user has to do sth. Second & third has the benefit that further languages could be added. 

          As we have a lot of different jobs for the same project second option would be best for us, but in case Jenkins is used for different projects (e.g. a Qt C++ project and a Typescript project) third option may be better. An combination would also be an option (e.g. create globally different named file mapping and within the call to recordIssue you reference one of the named mapping).
          drulli Ulli Hafner made changes -
          Epic Link JENKINS-62153 [ 206075 ]
          drulli Ulli Hafner made changes -
          Assignee Ulli Hafner [ drulli ]
          Labels help-wanted
          drulli Ulli Hafner made changes -
          Component/s prism-api-plugin [ 28824 ]
          Component/s warnings-ng-plugin [ 24526 ]
          Epic Link JENKINS-62153 [ 206075 ]

          People

            Unassigned Unassigned
            sunblack sunblack
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: