Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Visual Studio and Delphi project file types to the XML lexer #764

Closed
wants to merge 1 commit into from
Closed

Added Visual Studio and Delphi project file types to the XML lexer #764

wants to merge 1 commit into from

Conversation

qcz
Copy link

@qcz qcz commented Aug 25, 2017

Added the following file types to the XML lexer:

  • csproj: Microsoft Visual Studio C# project file
  • vbproj: Microsoft Visual Studio Visual Basic project file
  • dproj: Embarcadero Delphi Project File

The content of these file types is standard XML.

@gfx
Copy link
Member

gfx commented Aug 28, 2017

Thanks. The PR should work as expected, but I wonder why the XML lexer can't guess the file type for them.

Maybe improving Rouge::Lexers::XML.analyze_text is better.

@qcz qcz closed this Aug 28, 2017
@qcz qcz reopened this Aug 28, 2017
@pbregener
Copy link
Contributor

Guessing works just fine without this PR for me.

All my Visual Studio 2015 C/C++/Fortran files (vcproj, vcxproj, vfproj) start with

<?xml version="1.0" encoding="UTF-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

@qcz
Copy link
Author

qcz commented Aug 29, 2017

It does not work for me in GitLab (9.5.1) for csproj files:
firefox_2017-08-29_12-19-56

@pbregener
Copy link
Contributor

Works for me in GitLab... 😕

@gfx
Copy link
Member

gfx commented Aug 30, 2017

Gessing should be improved after #763

@pbregener
Copy link
Contributor

@gfx As mentioned, I cannot reproduce the problem anyways.

@jneen
Copy link
Member

jneen commented Aug 30, 2017

Since GitLab users are here - did you know you can manually override guessing with your .gitattributes file?

https://docs.gitlab.com/ce/user/project/highlighting.html

@qcz
Copy link
Author

qcz commented Aug 30, 2017

I've found the culprit: my csproj files have an UTF8 BOM at the start of the file (they are saved this way by default). If I remove them, GitLab successfully guesses the type of these files. As UTF8 BOM is a pretty common thing, it should not be a blocker of detecting the type of a file.

@pbregener
Copy link
Contributor

Still, I don't think the approach of this PR is the right solution for that problem. Maybe you can file a new issue and close this PR @qcz?

@qcz
Copy link
Author

qcz commented Sep 5, 2017

Done. See #767.

@qcz qcz closed this Sep 5, 2017
@qcz qcz deleted the additional-xml-types branch September 5, 2017 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants