F# takes priority over Forth language
This commit is contained in:
parent
0f02aa91b7
commit
62923d4ca0
5 changed files with 21 additions and 4 deletions
0
tests/samples/codefiles/fsharp.fs
Normal file
0
tests/samples/codefiles/fsharp.fs
Normal file
|
@ -221,3 +221,19 @@ class LanguagesTestCase(utils.TestCase):
|
|||
|
||||
language = u('Perl')
|
||||
self.assertEqual(self.patched['wakatime.offlinequeue.Queue.push'].call_args[0][0].get('language'), language)
|
||||
|
||||
def test_fsharp_detected_over_forth(self):
|
||||
response = Response()
|
||||
response.status_code = 500
|
||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||
|
||||
now = u(int(time.time()))
|
||||
config = 'tests/samples/configs/good_config.cfg'
|
||||
entity = 'tests/samples/codefiles/fsharp.fs'
|
||||
args = ['--file', entity, '--config', config, '--time', now]
|
||||
|
||||
retval = execute(args)
|
||||
self.assertEquals(retval, 102)
|
||||
|
||||
language = u('F#')
|
||||
self.assertEqual(self.patched['wakatime.offlinequeue.Queue.push'].call_args[0][0].get('language'), language)
|
||||
|
|
|
@ -148,7 +148,7 @@ LEXERS = {
|
|||
'EvoqueLexer': ('pygments.lexers.templates', 'Evoque', ('evoque',), ('*.evoque',), ('application/x-evoque',)),
|
||||
'EvoqueXmlLexer': ('pygments.lexers.templates', 'XML+Evoque', ('xml+evoque',), ('*.xml',), ('application/xml+evoque',)),
|
||||
'EzhilLexer': ('pygments.lexers.ezhil', 'Ezhil', ('ezhil',), ('*.n',), ('text/x-ezhil',)),
|
||||
'FSharpLexer': ('pygments.lexers.dotnet', 'FSharp', ('fsharp',), ('*.fs', '*.fsi'), ('text/x-fsharp',)),
|
||||
'FSharpLexer': ('pygments.lexers.dotnet', 'F#', ('fsharp',), ('*.fs', '*.fsi'), ('text/x-fsharp',)),
|
||||
'FactorLexer': ('pygments.lexers.factor', 'Factor', ('factor',), ('*.factor',), ('text/x-factor',)),
|
||||
'FancyLexer': ('pygments.lexers.ruby', 'Fancy', ('fancy', 'fy'), ('*.fy', '*.fancypack'), ('text/x-fancysrc',)),
|
||||
'FantomLexer': ('pygments.lexers.fantom', 'Fantom', ('fan',), ('*.fan',), ('application/x-fantom',)),
|
||||
|
|
|
@ -549,7 +549,7 @@ class FSharpLexer(RegexLexer):
|
|||
.. versionadded:: 1.5
|
||||
"""
|
||||
|
||||
name = 'FSharp'
|
||||
name = 'F#'
|
||||
aliases = ['fsharp']
|
||||
filenames = ['*.fs', '*.fsi']
|
||||
mimetypes = ['text/x-fsharp']
|
||||
|
|
|
@ -311,6 +311,7 @@ def custom_pygments_guess_lexer_for_filename(_fn, _text, **options):
|
|||
def customize_priority(lexer):
|
||||
"""Return an integer priority for the given lexer object."""
|
||||
|
||||
if lexer.name.lower() in LANGUAGES:
|
||||
lexer.priority = LANGUAGES[lexer.name.lower()]
|
||||
lexer_name = lexer.name.lower().replace('sharp', '#')
|
||||
if lexer_name in LANGUAGES:
|
||||
lexer.priority = LANGUAGES[lexer_name]
|
||||
return lexer
|
||||
|
|
Loading…
Reference in a new issue