From c915f43a994daf52f63ba7236e75dcb4d81da792 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Thu, 28 Mar 2024 00:59:23 +0000 Subject: [PATCH 1/6] Add typespec grammar from microsoft/typespec --- .gitmodules | 3 + grammars.yml | 2 + lib/linguist/languages.yml | 10 +++ samples/TypeSpec/json-schema.tsp | 43 +++++++++++ samples/TypeSpec/petstore.tsp | 71 +++++++++++++++++++ vendor/README.md | 1 + vendor/grammars/typespec | 1 + .../licenses/git_submodule/typespec.dep.yml | 31 ++++++++ 8 files changed, 162 insertions(+) create mode 100644 samples/TypeSpec/json-schema.tsp create mode 100644 samples/TypeSpec/petstore.tsp create mode 160000 vendor/grammars/typespec create mode 100644 vendor/licenses/git_submodule/typespec.dep.yml diff --git a/.gitmodules b/.gitmodules index d952dabc01..c75de36699 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1205,6 +1205,9 @@ [submodule "vendor/grammars/turtle.tmbundle"] path = vendor/grammars/turtle.tmbundle url = https://github.com/peta/turtle.tmbundle +[submodule "vendor/grammars/typespec"] + path = vendor/grammars/typespec + url = https://github.com/Microsoft/typespec.git [submodule "vendor/grammars/typst-grammar"] path = vendor/grammars/typst-grammar url = https://github.com/michidk/typst-grammar.git diff --git a/grammars.yml b/grammars.yml index 6092a1f229..6f2524b7ee 100644 --- a/grammars.yml +++ b/grammars.yml @@ -1082,6 +1082,8 @@ vendor/grammars/toml.tmbundle: vendor/grammars/turtle.tmbundle: - source.sparql - source.turtle +vendor/grammars/typespec: +- source.tsp vendor/grammars/typst-grammar: - source.typst vendor/grammars/verilog.tmbundle: diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index bfe0ebe9cc..113bcca321 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -8412,3 +8412,13 @@ xBase: tm_scope: source.harbour ace_mode: text language_id: 421 +TypeSpec: + type: programming + color: "#4A3665" + aliases: + - tsp + extensions: + - ".tsp" + tm_scope: source.tsp + ace_mode: text + language_id: 952272597 diff --git a/samples/TypeSpec/json-schema.tsp b/samples/TypeSpec/json-schema.tsp new file mode 100644 index 0000000000..dd709a18a7 --- /dev/null +++ b/samples/TypeSpec/json-schema.tsp @@ -0,0 +1,43 @@ +import "@typespec/json-schema"; + +using TypeSpec.JsonSchema; + +@jsonSchema +namespace Schemas; + +model Person { + /** The person's first name. */ + firstName: string; + + /** The person's last name. */ + lastName: string; + + /** Age in years which must be equal to or greater than zero. */ + @minValue(0) age: int32; + + /** Person address */ + address: Address; + + /** List of nick names */ + @uniqueItems nickNames?: string[]; + + /** List of cars person owns */ + cars?: Car[]; +} + +/** Respresent an address */ +model Address { + street: string; + city: string; + country: string; +} +model Car { + /** Kind of car */ + kind: "ev" | "ice"; + + /** Brand of the car */ + brand: string; + + /** Model of the car */ + `model`: string; +} \ No newline at end of file diff --git a/samples/TypeSpec/petstore.tsp b/samples/TypeSpec/petstore.tsp new file mode 100644 index 0000000000..cc4a48320a --- /dev/null +++ b/samples/TypeSpec/petstore.tsp @@ -0,0 +1,71 @@ +import "@typespec/rest"; +import "@typespec/openapi"; +import "./decorators.js"; + +using TypeSpec.Http; + +@service({ + title: "Pet Store Service", +}) +@doc("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.") +namespace PetStore; + +// Model types +model Pet { + name: string; + tag?: string; + + @minValue(0) + @maxValue(20) + age: int32; +} + +model Toy { + id: int64; + petId: int64; + name: string; +} + +@doc("Error") +@error +model Error { + code: int32; + message: string; +} + +@doc("Not modified") +model NotModified { + @statusCode _: 304; + @body body: Body; +} + +@friendlyName("{name}ListResults", Item) +model ResponsePage { + items: Item[]; + nextLink?: string; +} + +model PetId { + @path petId: int32; +} + +@doc("Manage your pets.") +@route("/pets") +namespace Pets { + @doc("Delete a pet.") + @delete + op delete(...PetId): OkResponse | Error; + + @fancyDoc("List pets.") + op list(@query nextLink?: string): ResponsePage | Error; + + @doc("Returns a pet. Supports eTags.") + op read(...PetId): Pet | (NotModifiedResponse & Pet) | Error; + + @post op create(@body pet: Pet): Pet | Error; +} + +@route("/pets/{petId}/toys") +namespace ListPetToysResponse { + op list(@path petId: string, @query nameFilter: string): ResponsePage | Error; +} \ No newline at end of file diff --git a/vendor/README.md b/vendor/README.md index 2dd99fc849..726709f0ed 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -574,6 +574,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting - **Twig:** [Anomareh/PHP-Twig.tmbundle](https://github.com/Anomareh/PHP-Twig.tmbundle) - **Type Language:** [goodmind/language-typelanguage](https://github.com/goodmind/language-typelanguage) - **TypeScript:** [tree-sitter/tree-sitter-typescript](https://github.com/tree-sitter/tree-sitter-typescript) 🐌 +- **TypeSpec:** [Microsoft/typespec](https://github.com/Microsoft/typespec) - **Typst:** [michidk/typst-grammar](https://github.com/michidk/typst-grammar) - **Unified Parallel C:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) - **Unity3D Asset:** [atom/language-yaml](https://github.com/atom/language-yaml) diff --git a/vendor/grammars/typespec b/vendor/grammars/typespec new file mode 160000 index 0000000000..ce9c567e5b --- /dev/null +++ b/vendor/grammars/typespec @@ -0,0 +1 @@ +Subproject commit ce9c567e5bfb441bb6415699a6b6fa797bc08f2e diff --git a/vendor/licenses/git_submodule/typespec.dep.yml b/vendor/licenses/git_submodule/typespec.dep.yml new file mode 100644 index 0000000000..9e4cd91a61 --- /dev/null +++ b/vendor/licenses/git_submodule/typespec.dep.yml @@ -0,0 +1,31 @@ +--- +name: typespec +version: ce9c567e5bfb441bb6415699a6b6fa797bc08f2e +type: git_submodule +homepage: https://github.com/Microsoft/typespec.git +license: mit +licenses: +- sources: LICENSE + text: |2 + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE +notices: [] From 8c83055243305592b2cbe6859a849487bce90587 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Thu, 28 Mar 2024 14:30:26 +0000 Subject: [PATCH 2/6] Add heuristic and fix microsoft org casing --- .gitmodules | 2 +- lib/linguist/heuristics.yml | 4 ++++ vendor/README.md | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index c75de36699..0b6cdffd03 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1207,7 +1207,7 @@ url = https://github.com/peta/turtle.tmbundle [submodule "vendor/grammars/typespec"] path = vendor/grammars/typespec - url = https://github.com/Microsoft/typespec.git + url = https://github.com/microsoft/typespec.git [submodule "vendor/grammars/typst-grammar"] path = vendor/grammars/typst-grammar url = https://github.com/michidk/typst-grammar.git diff --git a/lib/linguist/heuristics.yml b/lib/linguist/heuristics.yml index f06dec2bd9..04e45efde5 100644 --- a/lib/linguist/heuristics.yml +++ b/lib/linguist/heuristics.yml @@ -841,6 +841,10 @@ disambiguations: - language: JSON pattern: '\"modelName\"\:\s*\"GM' - language: Yacc +- extensions: ['.tsp'] + rules: + - language: TypeSpec + pattern: '^(import|using|namespace|interface|op|model|scalar|alias|union|enum)\s' named_patterns: cpp: - '^\s*#\s*include <(cstdint|string|vector|map|list|array|bitset|queue|stack|forward_list|unordered_map|unordered_set|(i|o|io)stream)>' diff --git a/vendor/README.md b/vendor/README.md index 726709f0ed..dc4d1f91d9 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -574,7 +574,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting - **Twig:** [Anomareh/PHP-Twig.tmbundle](https://github.com/Anomareh/PHP-Twig.tmbundle) - **Type Language:** [goodmind/language-typelanguage](https://github.com/goodmind/language-typelanguage) - **TypeScript:** [tree-sitter/tree-sitter-typescript](https://github.com/tree-sitter/tree-sitter-typescript) 🐌 -- **TypeSpec:** [Microsoft/typespec](https://github.com/Microsoft/typespec) +- **TypeSpec:** [microsoft/typespec](https://github.com/microsoft/typespec) - **Typst:** [michidk/typst-grammar](https://github.com/michidk/typst-grammar) - **Unified Parallel C:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) - **Unity3D Asset:** [atom/language-yaml](https://github.com/atom/language-yaml) From 2ecf680db21a71abacd4f6c1e6185527ba9e094b Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 3 Apr 2024 19:49:26 +0000 Subject: [PATCH 3/6] Add travelingsalesman language registration and heuristic --- lib/linguist/heuristics.yml | 2 + lib/linguist/languages.yml | 6 + samples/TravelingSalesmanProblem/att48.tsp | 105 ++++++++++++++++++ .../TravelingSalesmanProblem/dantzig42.tsp | 105 ++++++++++++++++++ 4 files changed, 218 insertions(+) create mode 100644 samples/TravelingSalesmanProblem/att48.tsp create mode 100644 samples/TravelingSalesmanProblem/dantzig42.tsp diff --git a/lib/linguist/heuristics.yml b/lib/linguist/heuristics.yml index 04e45efde5..7e08fc9620 100644 --- a/lib/linguist/heuristics.yml +++ b/lib/linguist/heuristics.yml @@ -845,6 +845,8 @@ disambiguations: rules: - language: TypeSpec pattern: '^(import|using|namespace|interface|op|model|scalar|alias|union|enum)\s' + - language: TravelingSalesmanProblem + pattern: '^(NAME|TYPE|DIMENSION|EDGE_WEIGHT_TYPE|EDGE_WEIGHT_FORMAT)\s*:' named_patterns: cpp: - '^\s*#\s*include <(cstdint|string|vector|map|list|array|bitset|queue|stack|forward_list|unordered_map|unordered_set|(i|o|io)stream)>' diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 113bcca321..d11a705799 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -8422,3 +8422,9 @@ TypeSpec: tm_scope: source.tsp ace_mode: text language_id: 952272597 +TravelingSalesmanProblem: + type: data + extensions: + - ".tsp" + ace_mode: text + language_id: 89289301 diff --git a/samples/TravelingSalesmanProblem/att48.tsp b/samples/TravelingSalesmanProblem/att48.tsp new file mode 100644 index 0000000000..b5569f97c1 --- /dev/null +++ b/samples/TravelingSalesmanProblem/att48.tsp @@ -0,0 +1,105 @@ +NAME : att48 +COMMENT : 48 capitals of the US (Padberg/Rinaldi) +TYPE : TSP +DIMENSION : 48 +EDGE_WEIGHT_TYPE : ATT +NODE_COORD_SECTION +1 6734 1453 +2 2233 10 +3 5530 1424 +4 401 841 +5 3082 1644 +6 7608 4458 +7 7573 3716 +8 7265 1268 +9 6898 1885 +10 1112 2049 +11 5468 2606 +12 5989 2873 +13 4706 2674 +14 4612 2035 +15 6347 2683 +16 6107 669 +17 7611 5184 +18 7462 3590 +19 7732 4723 +20 5900 3561 +21 4483 3369 +22 6101 1110 +23 5199 2182 +24 1633 2809 +25 4307 2322 +26 675 1006 +27 7555 4819 +28 7541 3981 +29 3177 756 +30 7352 4506 +31 7545 2801 +32 3245 3305 +33 6426 3173 +34 4608 1198 +35 23 2216 +36 7248 3779 +37 7762 4595 +38 7392 2244 +39 3484 2829 +40 6271 2135 +41 4985 140 +42 1916 1569 +43 7280 4899 +44 7509 3239 +45 10 2676 +46 6807 2993 +47 5185 3258 +48 3023 1942 +TOUR_SECTION +1 +8 +38 +31 +44 +18 +7 +28 +6 +37 +19 +27 +17 +43 +30 +36 +46 +33 +20 +47 +21 +32 +39 +48 +5 +42 +24 +10 +45 +35 +4 +26 +2 +29 +34 +41 +16 +22 +3 +23 +14 +25 +13 +11 +12 +15 +40 +9 +-1 +EOF \ No newline at end of file diff --git a/samples/TravelingSalesmanProblem/dantzig42.tsp b/samples/TravelingSalesmanProblem/dantzig42.tsp new file mode 100644 index 0000000000..cb88e6e56f --- /dev/null +++ b/samples/TravelingSalesmanProblem/dantzig42.tsp @@ -0,0 +1,105 @@ +NAME : dantzig42 +TYPE : TSP +COMMENT : 42 cities (Dantzig) +DIMENSION : 42 +EDGE_WEIGHT_TYPE : EXPLICIT +EDGE_WEIGHT_FORMAT : LOWER_DIAG_ROW +DISPLAY_DATA_TYPE : TWOD_DISPLAY +EDGE_WEIGHT_SECTION + 0 8 0 39 45 0 37 47 9 0 50 49 21 15 0 61 62 21 + 20 17 0 58 60 16 17 18 6 0 59 60 15 20 26 17 10 0 + 62 66 20 25 31 22 15 5 0 81 81 40 44 50 41 35 24 20 + 0 103 107 62 67 72 63 57 46 41 23 0 108 117 66 71 77 68 + 61 51 46 26 11 0 145 149 104 108 114 106 99 88 84 63 49 40 + 0 181 185 140 144 150 142 135 124 120 99 85 76 35 0 187 191 146 + 150 156 142 137 130 125 105 90 81 41 10 0 161 170 120 124 130 115 + 110 104 105 90 72 62 34 31 27 0 142 146 101 104 111 97 91 85 + 86 75 51 59 29 53 48 21 0 174 178 133 138 143 129 123 117 118 + 107 83 84 54 46 35 26 31 0 185 186 142 143 140 130 126 124 128 + 118 93 101 72 69 58 58 43 26 0 164 165 120 123 124 106 106 105 + 110 104 86 97 71 93 82 62 42 45 22 0 137 139 94 96 94 80 + 78 77 84 77 56 64 65 90 87 58 36 68 50 30 0 117 122 77 + 80 83 68 62 60 61 50 34 42 49 82 77 60 30 62 70 49 21 + 0 114 118 73 78 84 69 63 57 59 48 28 36 43 77 72 45 27 + 59 69 55 27 5 0 85 89 44 48 53 41 34 28 29 22 23 35 + 69 105 102 74 56 88 99 81 54 32 29 0 77 80 36 40 46 34 + 27 19 21 14 29 40 77 114 111 84 64 96 107 87 60 40 37 8 + 0 87 89 44 46 46 30 28 29 32 27 36 47 78 116 112 84 66 + 98 95 75 47 36 39 12 11 0 91 93 48 50 48 34 32 33 36 + 30 34 45 77 115 110 83 63 97 91 72 44 32 36 9 15 3 0 + 105 106 62 63 64 47 46 49 54 48 46 59 85 119 115 88 66 98 + 79 59 31 36 42 28 33 21 20 0 111 113 69 71 66 51 53 56 + 61 57 59 71 96 130 126 98 75 98 85 62 38 47 53 39 42 29 + 30 12 0 91 92 50 51 46 30 34 38 43 49 60 71 103 141 136 + 109 90 115 99 81 53 61 62 36 34 24 28 20 20 0 83 85 42 + 43 38 22 26 32 36 51 63 75 106 142 140 112 93 126 108 88 60 + 64 66 39 36 27 31 28 28 8 0 89 91 55 55 50 34 39 44 + 49 63 76 87 120 155 150 123 100 123 109 86 62 71 78 52 49 39 + 44 35 24 15 12 0 95 97 64 63 56 42 49 56 60 75 86 97 + 126 160 155 128 104 128 113 90 67 76 82 62 59 49 53 40 29 25 + 23 11 0 74 81 44 43 35 23 30 39 44 62 78 89 121 159 155 + 127 108 136 124 101 75 79 81 54 50 42 46 43 39 23 14 14 21 + 0 67 69 42 41 31 25 32 41 46 64 83 90 130 164 160 133 114 + 146 134 111 85 84 86 59 52 47 51 53 49 32 24 24 30 9 0 + 74 76 61 60 42 44 51 60 66 83 102 110 147 185 179 155 133 159 + 146 122 98 105 107 79 71 66 70 70 60 48 40 36 33 25 18 0 + 57 59 46 41 25 30 36 47 52 71 93 98 136 172 172 148 126 158 + 147 124 121 97 99 71 65 59 63 67 62 46 38 37 43 23 13 17 + 0 45 46 41 34 20 34 38 48 53 73 96 99 137 176 178 151 131 + 163 159 135 108 102 103 73 67 64 69 75 72 54 46 49 54 34 24 + 29 12 0 35 37 35 26 18 34 36 46 51 70 93 97 134 171 176 + 151 129 161 163 139 118 102 101 71 65 65 70 84 78 58 50 56 62 + 41 32 38 21 9 0 29 33 30 21 18 35 33 40 45 65 87 91 + 117 166 171 144 125 157 156 139 113 95 97 67 60 62 67 79 82 62 + 53 59 66 45 38 45 27 15 6 0 3 11 41 37 47 57 55 58 + 63 83 105 109 147 186 188 164 144 176 182 161 134 119 116 86 78 84 + 88 101 108 88 80 86 92 71 64 71 54 41 32 25 0 5 12 55 + 41 53 64 61 61 66 84 111 113 150 186 192 166 147 180 188 167 140 + 124 119 90 87 90 94 107 114 77 86 92 98 80 74 77 60 48 38 + 32 6 0 +DISPLAY_DATA_SECTION + 1 170.0 85.0 + 2 166.0 88.0 + 3 133.0 73.0 + 4 140.0 70.0 + 5 142.0 55.0 + 6 126.0 53.0 + 7 125.0 60.0 + 8 119.0 68.0 + 9 117.0 74.0 + 10 99.0 83.0 + 11 73.0 79.0 + 12 72.0 91.0 + 13 37.0 94.0 + 14 6.0 106.0 + 15 3.0 97.0 + 16 21.0 82.0 + 17 33.0 67.0 + 18 4.0 66.0 + 19 3.0 42.0 + 20 27.0 33.0 + 21 52.0 41.0 + 22 57.0 59.0 + 23 58.0 66.0 + 24 88.0 65.0 + 25 99.0 67.0 + 26 95.0 55.0 + 27 89.0 55.0 + 28 83.0 38.0 + 29 85.0 25.0 + 30 104.0 35.0 + 31 112.0 37.0 + 32 112.0 24.0 + 33 113.0 13.0 + 34 125.0 30.0 + 35 135.0 32.0 + 36 147.0 18.0 + 37 147.5 36.0 + 38 154.5 45.0 + 39 157.0 54.0 + 40 158.0 61.0 + 41 172.0 82.0 + 42 174.0 87.0 +EOF + + From 857e9e90111e405834034913da874702d1ad49a4 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 3 Apr 2024 16:36:30 -0700 Subject: [PATCH 4/6] Update lib/linguist/languages.yml Co-authored-by: John Gardner --- lib/linguist/languages.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index d11a705799..40d27fecf9 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -8422,7 +8422,10 @@ TypeSpec: tm_scope: source.tsp ace_mode: text language_id: 952272597 -TravelingSalesmanProblem: +TSPLIB data: + aliases: + - travelling salesman problem + - traveling salesman problem type: data extensions: - ".tsp" From d9d1447ef53e4c68f74725553d993d5455c8b963 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Wed, 3 Apr 2024 16:36:35 -0700 Subject: [PATCH 5/6] Update lib/linguist/heuristics.yml Co-authored-by: John Gardner --- lib/linguist/heuristics.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linguist/heuristics.yml b/lib/linguist/heuristics.yml index 7e08fc9620..25d62d5d40 100644 --- a/lib/linguist/heuristics.yml +++ b/lib/linguist/heuristics.yml @@ -845,7 +845,7 @@ disambiguations: rules: - language: TypeSpec pattern: '^(import|using|namespace|interface|op|model|scalar|alias|union|enum)\s' - - language: TravelingSalesmanProblem + - language: TSPLIB data pattern: '^(NAME|TYPE|DIMENSION|EDGE_WEIGHT_TYPE|EDGE_WEIGHT_FORMAT)\s*:' named_patterns: cpp: From 392acb14f2a05864517f324ac55144643396b253 Mon Sep 17 00:00:00 2001 From: Alhadis Date: Thu, 4 Apr 2024 20:13:22 +1100 Subject: [PATCH 6/6] Rename samples directory and fix test failures --- lib/linguist/heuristics.yml | 12 +++--- lib/linguist/languages.yml | 39 ++++++++++--------- .../att48.tsp | 0 .../dantzig42.tsp | 0 test/test_heuristics.rb | 7 ++++ 5 files changed, 33 insertions(+), 25 deletions(-) rename samples/{TravelingSalesmanProblem => TSPLIB data}/att48.tsp (100%) rename samples/{TravelingSalesmanProblem => TSPLIB data}/dantzig42.tsp (100%) diff --git a/lib/linguist/heuristics.yml b/lib/linguist/heuristics.yml index 25d62d5d40..8601628c40 100644 --- a/lib/linguist/heuristics.yml +++ b/lib/linguist/heuristics.yml @@ -746,6 +746,12 @@ disambiguations: - language: XML pattern: '' diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 40d27fecf9..e7c47e2403 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -7001,6 +7001,16 @@ TOML: codemirror_mode: toml codemirror_mime_type: text/x-toml language_id: 365 +TSPLIB data: + aliases: + - travelling salesman problem + - traveling salesman problem + type: data + extensions: + - ".tsp" + tm_scope: none + ace_mode: text + language_id: 89289301 TSQL: type: programming color: "#e38c00" @@ -7292,6 +7302,16 @@ TypeScript: codemirror_mode: javascript codemirror_mime_type: application/typescript language_id: 378 +TypeSpec: + type: programming + color: "#4A3665" + aliases: + - tsp + extensions: + - ".tsp" + tm_scope: source.tsp + ace_mode: text + language_id: 952272597 Typst: type: programming color: "#239dad" @@ -8412,22 +8432,3 @@ xBase: tm_scope: source.harbour ace_mode: text language_id: 421 -TypeSpec: - type: programming - color: "#4A3665" - aliases: - - tsp - extensions: - - ".tsp" - tm_scope: source.tsp - ace_mode: text - language_id: 952272597 -TSPLIB data: - aliases: - - travelling salesman problem - - traveling salesman problem - type: data - extensions: - - ".tsp" - ace_mode: text - language_id: 89289301 diff --git a/samples/TravelingSalesmanProblem/att48.tsp b/samples/TSPLIB data/att48.tsp similarity index 100% rename from samples/TravelingSalesmanProblem/att48.tsp rename to samples/TSPLIB data/att48.tsp diff --git a/samples/TravelingSalesmanProblem/dantzig42.tsp b/samples/TSPLIB data/dantzig42.tsp similarity index 100% rename from samples/TravelingSalesmanProblem/dantzig42.tsp rename to samples/TSPLIB data/dantzig42.tsp diff --git a/test/test_heuristics.rb b/test/test_heuristics.rb index 4ac8cdf340..68fa6c686d 100755 --- a/test/test_heuristics.rb +++ b/test/test_heuristics.rb @@ -991,6 +991,13 @@ def test_ts_by_heuristics }) end + def test_tsp_by_heuristics + assert_heuristics({ + "TypeSpec" => all_fixtures("TypeSpec", "*.tsp"), + "TSPLIB data" => all_fixtures("TSPLIB data", "*.tsp") + }) + end + def test_tst_by_heuristics assert_heuristics({ "GAP" => all_fixtures("GAP", "*.tst"),