Skip to content

Commit 15983d5

Browse files
Added support for Solution (.sln) files (#2213)
This adds support for VS Solution files. https://docs.microsoft.com/en-us/visualstudio/extensibility/internals/solution-dot-sln-file?view=vs-2019
1 parent 5362ba1 commit 15983d5

15 files changed

Lines changed: 328 additions & 3 deletions

components.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,11 @@
939939
"require": "clike",
940940
"owner": "glachaud"
941941
},
942+
"solution-file": {
943+
"title": "Solution file",
944+
"alias": "sln",
945+
"owner": "RunDevelopment"
946+
},
942947
"soy": {
943948
"title": "Soy (Closure Template)",
944949
"require": "markup-templating",

components/prism-solution-file.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
(function (Prism){
2+
3+
var guid = {
4+
// https://en.wikipedia.org/wiki/Universally_unique_identifier#Format
5+
pattern: /\{[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}\}/i,
6+
alias: 'constant',
7+
inside: {
8+
'punctuation': /[{}]/
9+
}
10+
};
11+
12+
Prism.languages['solution-file'] = {
13+
'comment': {
14+
pattern: /#.*/,
15+
greedy: true
16+
},
17+
'string': {
18+
pattern: /"[^"\r\n]*"|'[^'\r\n]*'/,
19+
greedy: true,
20+
inside: {
21+
'guid': guid
22+
}
23+
},
24+
'object': {
25+
// Foo
26+
// Bar("abs") = 9
27+
// EndBar
28+
// Prop = TRUE
29+
// EndFoo
30+
pattern: /^([ \t]*)(?:([A-Z]\w*)\b(?=.*(?:\r\n?|\n)(?:\1[ \t].*(?:\r\n?|\n))*\1End\2(?=[ \t]*$))|End[A-Z]\w*(?=[ \t]*$))/m,
31+
lookbehind: true,
32+
greedy: true,
33+
alias: 'keyword'
34+
},
35+
'property': {
36+
pattern: /^([ \t]*)[^\r\n"#=()]*[^\s"#=()](?=\s*=)/m,
37+
lookbehind: true,
38+
inside: {
39+
'guid': guid
40+
}
41+
},
42+
'guid': guid,
43+
'number': /\b\d+(?:\.\d+)*\b/,
44+
'boolean': /\b(?:FALSE|TRUE)\b/,
45+
'operator': /=/,
46+
'punctuation': /[(),]/
47+
};
48+
49+
Prism.languages['sln'] = Prism.languages['solution-file'];
50+
51+
}(Prism));

components/prism-solution-file.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/prism-solution-file.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<h2>Full example</h2>
2+
<pre><code># https://docs.microsoft.com/en-us/visualstudio/extensibility/internals/solution-dot-sln-file?view=vs-2015&redirectedfrom=MSDN
3+
Microsoft Visual Studio Solution File, Format Version 12.00
4+
# Visual Studio Version 16
5+
VisualStudioVersion = 16.0.29709.97
6+
MinimumVisualStudioVersion = 10.0.40219.1
7+
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Project1", "Project1.vbproj", "{8CDD8387-B905-44A8-B5D5-07BB50E05BEA}"
8+
EndProject
9+
Global
10+
GlobalSection(SolutionNotes) = postSolution
11+
EndGlobalSection
12+
GlobalSection(SolutionConfiguration) = preSolution
13+
ConfigName.0 = Debug
14+
ConfigName.1 = Release
15+
EndGlobalSection
16+
GlobalSection(ProjectDependencies) = postSolution
17+
EndGlobalSection
18+
GlobalSection(ProjectConfiguration) = postSolution
19+
{8CDD8387-B905-44A8-B5D5-07BB50E05BEA}.Debug.ActiveCfg = Debug|x86
20+
{8CDD8387-B905-44A8-B5D5-07BB50E05BEA}.Debug.Build.0 = Debug|x86
21+
{8CDD8387-B905-44A8-B5D5-07BB50E05BEA}.Release.ActiveCfg = Release|x86
22+
{8CDD8387-B905-44A8-B5D5-07BB50E05BEA}.Release.Build.0 = Release|x86
23+
EndGlobalSection
24+
GlobalSection(ExtensibilityGlobals) = postSolution
25+
EndGlobalSection
26+
GlobalSection(ExtensibilityAddIns) = postSolution
27+
EndGlobalSection
28+
EndGlobal</code></pre>

plugins/autoloader/prism-autoloader.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@
170170
"py": "python",
171171
"robot": "robotframework",
172172
"rb": "ruby",
173+
"sln": "solution-file",
173174
"rq": "sparql",
174175
"trig": "turtle",
175176
"ts": "typescript",

plugins/autoloader/prism-autoloader.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/show-language/prism-show-language.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@
135135
"scss": "Sass (Scss)",
136136
"shell-session": "Shell session",
137137
"solidity": "Solidity (Ethereum)",
138+
"solution-file": "Solution file",
139+
"sln": "Solution file",
138140
"soy": "Soy (Closure Template)",
139141
"sparql": "SPARQL",
140142
"rq": "SPARQL",

plugins/show-language/prism-show-language.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
TRUE
2+
FALSE
3+
4+
----------------------------------------------------
5+
6+
[
7+
["boolean", "TRUE"],
8+
["boolean", "FALSE"]
9+
]
10+
11+
----------------------------------------------------
12+
13+
Checks for booleans.

0 commit comments

Comments
 (0)