github-linguist 8.0.1 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/grammars/go.mod.json +1 -1
  3. data/grammars/markdown.vue.codeblock.json +1 -0
  4. data/grammars/mdx.vue.codeblock.json +1 -0
  5. data/grammars/source.QB64.json +1 -0
  6. data/grammars/source.abap.json +1 -1
  7. data/grammars/source.abl.json +1 -1
  8. data/grammars/source.angelscript.json +1 -1
  9. data/grammars/source.basic.json +1 -1
  10. data/grammars/source.bb.json +1 -1
  11. data/grammars/source.brs.json +1 -1
  12. data/grammars/source.bsl.json +1 -1
  13. data/grammars/source.cmake.json +1 -1
  14. data/grammars/source.cmakecache.json +1 -0
  15. data/grammars/source.cobol.json +1 -1
  16. data/grammars/source.dart.json +1 -1
  17. data/grammars/source.fsharp.json +1 -1
  18. data/grammars/source.gdscript.json +1 -1
  19. data/grammars/source.graphql.json +1 -1
  20. data/grammars/source.hcl.json +1 -1
  21. data/grammars/source.hcl.terraform.json +1 -1
  22. data/grammars/source.julia.json +1 -1
  23. data/grammars/source.just.json +1 -1
  24. data/grammars/source.luau.json +1 -1
  25. data/grammars/source.matlab.json +1 -1
  26. data/grammars/source.mdx.astro.json +1 -0
  27. data/grammars/source.mdx.json +1 -1
  28. data/grammars/source.moonbit.json +1 -0
  29. data/grammars/source.msg.json +1 -0
  30. data/grammars/source.ned.json +1 -0
  31. data/grammars/source.nushell.json +1 -1
  32. data/grammars/source.odin.json +1 -1
  33. data/grammars/source.openesql.json +1 -0
  34. data/grammars/source.p4.json +1 -1
  35. data/grammars/source.polar.json +1 -1
  36. data/grammars/source.powerbuilder.json +1 -1
  37. data/grammars/source.rescript.json +1 -1
  38. data/grammars/source.rpgle.json +1 -1
  39. data/grammars/source.scala.json +1 -1
  40. data/grammars/source.sdbl.json +1 -1
  41. data/grammars/source.tact.json +1 -0
  42. data/grammars/source.toc.json +1 -1
  43. data/grammars/source.ts.json +1 -1
  44. data/grammars/source.tsp.json +1 -0
  45. data/grammars/source.tsx.json +1 -1
  46. data/grammars/source.vba.json +1 -1
  47. data/grammars/source.vue.json +1 -0
  48. data/grammars/source.wdl.json +1 -1
  49. data/grammars/text.adblock.json +1 -1
  50. data/grammars/text.md.json +1 -1
  51. data/grammars/version +1 -1
  52. data/grammars/vue.directives.json +1 -0
  53. data/grammars/vue.interpolations.json +1 -0
  54. data/grammars/vue.sfc.style.variable.injection.json +1 -0
  55. data/lib/linguist/VERSION +1 -1
  56. data/lib/linguist/generated.rb +31 -0
  57. data/lib/linguist/generic.yml +1 -0
  58. data/lib/linguist/heuristics.yml +55 -11
  59. data/lib/linguist/languages.json +1 -1
  60. data/lib/linguist/languages.yml +93 -3
  61. data/lib/linguist/lazy_blob.rb +15 -7
  62. data/lib/linguist/repository.rb +18 -13
  63. data/lib/linguist/samples.json +1 -1
  64. data/lib/linguist/source/diff.rb +72 -0
  65. data/lib/linguist/source/repository.rb +64 -0
  66. data/lib/linguist/source/rugged.rb +95 -0
  67. metadata +21 -6
  68. data/grammars/source.cache.cmake.json +0 -1
  69. data/grammars/text.html.vue.json +0 -1
  70. data/grammars/text.mdx.astro.codeblock.json +0 -1
data/grammars/version CHANGED
@@ -1 +1 @@
1
- 8.0.1
1
+ 9.0.0
@@ -0,0 +1 @@
1
+ {"scopeName":"vue.directives","patterns":[{"include":"source.vue#vue-directives"}]}
@@ -0,0 +1 @@
1
+ {"scopeName":"vue.interpolations","patterns":[{"include":"source.vue#vue-interpolations"}]}
@@ -0,0 +1 @@
1
+ {"scopeName":"vue.sfc.style.variable.injection","patterns":[{"include":"#vue-sfc-style-variable-injection"}],"repository":{"vue-sfc-style-variable-injection":{"name":"vue.sfc.style.variable.injection.v-bind","begin":"\\b(v-bind)\\s*\\(","end":"\\)","patterns":[{"name":"source.ts.embedded.html.vue","begin":"('|\")","end":"(\\1)","patterns":[{"include":"source.js"}],"beginCaptures":{"1":{"name":"punctuation.definition.tag.begin.html"}},"endCaptures":{"1":{"name":"punctuation.definition.tag.end.html"}}},{"include":"source.js"}],"beginCaptures":{"1":{"name":"entity.name.function"}}}}}
data/lib/linguist/VERSION CHANGED
@@ -1 +1 @@
1
- 8.0.1
1
+ 9.0.0
@@ -70,6 +70,7 @@ module Linguist
70
70
  poetry_lock? ||
71
71
  pdm_lock? ||
72
72
  uv_lock? ||
73
+ pixi_lock? ||
73
74
  esy_lock? ||
74
75
  npm_shrinkwrap_or_package_lock? ||
75
76
  pnpm_lock? ||
@@ -91,6 +92,7 @@ module Linguist
91
92
  generated_protocol_buffer_from_go? ||
92
93
  generated_protocol_buffer? ||
93
94
  generated_javascript_protocol_buffer? ||
95
+ generated_typescript_protocol_buffer? ||
94
96
  generated_apache_thrift? ||
95
97
  generated_jni_header? ||
96
98
  vcr_cassette? ||
@@ -367,6 +369,28 @@ module Linguist
367
369
  return lines[5].include?("GENERATED CODE -- DO NOT EDIT!")
368
370
  end
369
371
 
372
+ # Internal: Is the blob a TypeScript source file generated by the
373
+ # Protocol Buffer compiler?
374
+ #
375
+ # Files generated by ts-proto typically start with something like this
376
+ # (though the versions lines are optional):
377
+ #
378
+ # // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
379
+ # // versions:
380
+ # // protoc-gen-ts_proto v1.181.2
381
+ # // protoc v5.28.2
382
+ # // source: hello.proto
383
+ #
384
+ # /* eslint-disable */
385
+ #
386
+ # Returns true or false.
387
+ def generated_typescript_protocol_buffer?
388
+ return false unless extname == ".ts"
389
+ return false unless lines.count > 4
390
+
391
+ return lines[0].include?("Code generated by protoc-gen-ts_proto. DO NOT EDIT.")
392
+ end
393
+
370
394
  APACHE_THRIFT_EXTENSIONS = ['.rb', '.py', '.go', '.js', '.m', '.java', '.h', '.cc', '.cpp', '.php']
371
395
 
372
396
  # Internal: Is the blob generated by Apache Thrift compiler?
@@ -431,6 +455,13 @@ module Linguist
431
455
  !!name.match(/uv\.lock/)
432
456
  end
433
457
 
458
+ # Internal: Is the blob a generated pixi lock file?
459
+ #
460
+ # Returns true or false.
461
+ def pixi_lock?
462
+ !!name.match(/pixi\.lock/)
463
+ end
464
+
434
465
  # Internal: Is the blob a generated esy lock file?
435
466
  #
436
467
  # Returns true or false.
@@ -16,6 +16,7 @@ extensions:
16
16
  - ".9"
17
17
  - ".app"
18
18
  - ".cmp"
19
+ - ".msg"
19
20
  - ".resource"
20
21
  - ".sol"
21
22
  - ".stl"
@@ -90,14 +90,18 @@ disambiguations:
90
90
  rules:
91
91
  - language: B4X
92
92
  pattern: '\A\W{0,3}(?:.*(?:\r?\n|\r)){0,9}B4(?:J|A|R|i)=true'
93
- - language: FreeBasic
94
- pattern: '^[ \t]*#(?i)(?:define|endif|endmacro|ifn?def|include|lang|macro)(?:$|\s)'
93
+ - language: FreeBASIC
94
+ named_pattern: freebasic
95
+ - language: FreeBASIC
96
+ and:
97
+ - pattern: '(?i)^[ \t]*return '
98
+ - negative_pattern: '(?i)[ \t]*gosub '
95
99
  - language: BASIC
96
100
  pattern: '\A\s*\d'
101
+ - language: QuickBASIC
102
+ named_pattern: quickbasic
97
103
  - language: VBA
98
- and:
99
- - named_pattern: vb-module
100
- - named_pattern: vba
104
+ named_pattern: vba
101
105
  - language: Visual Basic 6.0
102
106
  named_pattern: vb-module
103
107
  - extensions: ['.bb']
@@ -120,8 +124,12 @@ disambiguations:
120
124
  pattern: '(>\+>|>\+<)'
121
125
  - extensions: ['.bi']
122
126
  rules:
123
- - language: FreeBasic
124
- pattern: '^[ \t]*#(?i)(?:define|endif|endmacro|ifn?def|if|include|lang|macro)(?:$|\s)'
127
+ - language: FreeBASIC
128
+ named_pattern: freebasic
129
+ - language: FreeBASIC
130
+ and:
131
+ - pattern: '(?i)^[ \t]*return '
132
+ - negative_pattern: '(?i)[ \t]*gosub '
125
133
  - extensions: ['.bs']
126
134
  rules:
127
135
  - language: Bikeshed
@@ -496,6 +504,10 @@ disambiguations:
496
504
  - negative_pattern: '/\*'
497
505
  - pattern: '^\s*\.(?:include\s|globa?l\s|[A-Za-z][_A-Za-z0-9]*:)'
498
506
  - language: MAXScript
507
+ - extensions: ['.msg']
508
+ rules:
509
+ - language: omnetpp-msg
510
+ pattern: '^cplusplus \{\{|^namespace[\s]*([^.\s]*\.)*[^.\s]*;|^struct \{|^message [\S]* (extends)? [\S]*[\s]*\{|^packet \{|^class (extends) [\S]*[\s]*\{|^enum \{|^import ([^.\s]*\.)*[^.\s]*;'
499
511
  - extensions: ['.n']
500
512
  rules:
501
513
  - language: Roff
@@ -753,6 +765,11 @@ disambiguations:
753
765
  pattern: '^\s*(?:use\s+v6\b|\bmodule\b|\bmy\s+class\b)'
754
766
  - language: Turing
755
767
  pattern: '^\s*%[ \t]+|^\s*var\s+\w+(\s*:\s*\w+)?\s*:=\s*\w+'
768
+ - extensions: ['.tact']
769
+ rules:
770
+ - language: JSON
771
+ pattern: '\A\s*\{\"'
772
+ - language: Tact
756
773
  - extensions: ['.tag']
757
774
  rules:
758
775
  - language: Java Server Pages
@@ -772,6 +789,12 @@ disambiguations:
772
789
  - language: XML
773
790
  pattern: '<TS\b'
774
791
  - language: TypeScript
792
+ - extensions: ['.tsp']
793
+ rules:
794
+ - language: TypeSpec
795
+ pattern: '^(import|using|namespace|interface|op|model|scalar|alias|union|enum)\s'
796
+ - language: TSPLIB data
797
+ pattern: '^(NAME|TYPE|DIMENSION|EDGE_WEIGHT_TYPE|EDGE_WEIGHT_FORMAT)\s*:'
775
798
  - extensions: ['.tst']
776
799
  rules:
777
800
  - language: GAP
@@ -780,10 +803,9 @@ disambiguations:
780
803
  - language: Scilab
781
804
  - extensions: ['.tsx']
782
805
  rules:
783
- - language: TSX
784
- pattern: '^\s*(import.+(from\s+|require\()[''"]react|\/\/\/\s*<reference\s)'
785
806
  - language: XML
786
807
  pattern: '(?i:^\s*<\?xml\s+version)'
808
+ - language: TSX
787
809
  - extensions: ['.txt']
788
810
  rules:
789
811
  # The following RegExp is simply a collapsed and simplified form of the
@@ -914,6 +936,10 @@ named_patterns:
914
936
  - '^\s*(?:public\s+)?include\s'
915
937
  - '^\s*(?:(?:public|export|global)\s+)?(?:atom|constant|enum|function|integer|object|procedure|sequence|type)\s'
916
938
  fortran: '^(?i:[c*][^abd-z]| (subroutine|program|end|data)\s|\s*!)'
939
+ freebasic:
940
+ - '(?i)^[ \t]*#(?:define|endif|endmacro|ifn?def|include|lang|macro|pragma)(?:$|\s)'
941
+ - '(?i)^[ \t]*dim( shared)? [a-z_][a-z0-9_]* as [a-z_][a-z0-9_]* ptr'
942
+ - '(?i)^[ \t]*dim( shared)? as [a-z_][a-z0-9_]* [a-z_][a-z0-9_]*'
917
943
  gsc:
918
944
  - '^\s*#\s*(?:using|insert|include|define|namespace)[ \t]+\w'
919
945
  - '^\s*(?>(?:autoexec|private)\s+){0,2}function\s+(?>(?:autoexec|private)\s+){0,2}\w+\s*\('
@@ -941,6 +967,24 @@ named_patterns:
941
967
  - '^\s*(?:\*|(?:our\s*)?@)EXPORT\s*='
942
968
  - '^\s*package\s+[^\W\d]\w*(?:::\w+)*\s*(?:[;{]|\sv?\d)'
943
969
  - '[\s$][^\W\d]\w*(?::\w+)*->[a-zA-Z_\[({]'
970
+ quickbasic:
971
+ # Uppercase keywords are a good indicator of QuickBASIC (if no FreeBASIC syntax is detected)
972
+ - '^[ ]*(CONST|DIM|REDIM|DEFINT|PRINT|DECLARE (SUB|FUNCTION)|FUNCTION|SUB) '
973
+ # Preprocessor statement to set the compiler dialect in QuickBASIC ($lang) and FreeBASIC (#lang)
974
+ - '(#|$)lang:?\s*"?qb"?'
975
+ # Other QuickBASIC-specific patterns
976
+ - '(?i)''\$INCLUDE:'
977
+ - '(?i)^[ ]*CLS[ ]*(''|:|\r|\n)'
978
+ - '(?i)^[ ]*OPTION _EXPLICIT'
979
+ - '(?i)^[ ]*DIM SHARED '
980
+ - '(?i)^[ ]*PRINT "'
981
+ - '(?i) As _(Byte|Offset|MEM)'
982
+ - '(?i)^[ ]*_(DISPLAY|DEST|CONSOLE|SOURCE|FREEIMAGE|PALETTECOLOR|PRINTSTRING|LOADFONT|PUTIMAGE)'
983
+ - '(?i)^[ ]*_(TITLE|PLAYMOD) "'
984
+ - '(?i)^[ ]*_(LIMIT|SCREEN|DELAY) \.?\d+'
985
+ - '(?i)\b_(MOUSEBUTTON|NEWIMAGE|KEYDOWN|WIDTH|HEIGHT)\('
986
+ - '(?i)^[ ]*\$(CONSOLE|CHECKING):'
987
+ - '(?i)^[ ]*\$(FULLSCREEN|RESIZE|STATIC|DYNAMIC|NOPREFIX|SCREENSHOW|SCREENHIDE|EXEICON)\b'
944
988
  raku: '^\s*(?:use\s+v6\b|\bmodule\b|\b(?:my\s+)?class\b)'
945
989
  vb-class: '^[ ]*VERSION [0-9]\.[0-9] CLASS'
946
990
  vb-form: '^[ ]*VERSION [0-9]\.[0-9]{2}'
@@ -952,12 +996,12 @@ named_patterns:
952
996
  - '^[ ]*#If Win64\b'
953
997
  - '^[ ]*(?:Dim|Const) [0-9a-zA-Z_]*[ ]*As Long(?:Ptr|Long)\b'
954
998
  # Top module declarations unique to VBA
955
- - '^[ ]*Option (?:Private Module|Compare (?:Database|Text|Binary))\b'
999
+ - '^[ ]*Option (?:Private Module|Compare Database)\b'
956
1000
  # General VBA libraries and objects
957
1001
  - '(?: |\()(?:Access|Excel|Outlook|PowerPoint|Visio|Word|VBIDE)\.\w'
958
1002
  - '\b(?:(?:Active)?VBProjects?|VBComponents?|Application\.(?:VBE|ScreenUpdating))\b'
959
1003
  # AutoCAD, Outlook, PowerPoint and Word objects
960
- - '\b(?:ThisDrawing|AcadObject|Active(?:Explorer|Inspector|Window\.Presentation|Presentation|Document)|Selection\.(?:Find|Paragraphs))\b'
1004
+ - '\b(?:ThisDrawing|AcadObject|Active(?:Explorer|Inspector|Window\.Presentation|Presentation|Document)|Selection\.(?:Document|Find|Paragraphs|Range))\b'
961
1005
  # Excel objects
962
1006
  - '\b(?:(?:This|Active)?Workbooks?|Worksheets?|Active(?:Sheet|Chart|Cell)|WorksheetFunction)\b'
963
1007
  - '\b(?:Range\(".*|Cells\([0-9a-zA-Z_]*, (?:[0-9a-zA-Z_]*|"[a-zA-Z]{1,3}"))\)'