Skip to content

Commit

Permalink
Basic LaTeX built-in extension (microsoft#138395)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlelong authored Dec 15, 2021
1 parent c637386 commit 65a12fa
Show file tree
Hide file tree
Showing 20 changed files with 29,227 additions and 0 deletions.
13 changes: 13 additions & 0 deletions extensions/latex/build/update-grammars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';

var updateGrammar = require('vscode-grammar-updater');

updateGrammar.update('jlelong/vscode-latex-basics', 'syntaxes/Bibtex.tmLanguage.json', 'syntaxes/Bibtex.tmLanguage.json', undefined, 'main');
updateGrammar.update('jlelong/vscode-latex-basics', 'syntaxes/LaTeX.tmLanguage.json', 'syntaxes/LaTeX.tmLanguage.json', undefined, 'main');
updateGrammar.update('jlelong/vscode-latex-basics', 'syntaxes/TeX.tmLanguage.json', 'syntaxes/TeX.tmLanguage.json', undefined, 'main');
updateGrammar.update('jlelong/vscode-latex-basics', 'syntaxes/cpp-grammar-bailout.tmLanguage.json', 'syntaxes/cpp-grammar-bailout.tmLanguage.json', undefined, 'main');
updateGrammar.update('jlelong/vscode-latex-basics', 'syntaxes/markdown-latex-combined.tmLanguage.json', 'syntaxes/markdown-latex-combined.tmLanguage.json', undefined, 'main');
38 changes: 38 additions & 0 deletions extensions/latex/cgmanifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"registrations": [
{
"component": {
"type": "git",
"git": {
"name": "jlelong/vscode-latex-basics",
"repositoryUrl": "https://github.com/jlelong/vscode-latex-basics",
"commitHash": "e1bb99ae10eae344e7c72f5b17e81ff7377991c4"
}
},
"license": "MIT",
"version": "1.0.0",
"description": "The files in syntaxes/ were originally part of https://github.com/James-Yu/LaTeX-Workshop. They have been extracted in the hope that they can useful outside of the LaTeX-Workshop extension.",
"licenseDetail": [
"Copyright (c) vscode-latex-basics authors",
"",
"If not otherwise specified (see below), files in this repository fall under the MIT License",
"",
"",
"The file syntaxes/LaTeX.tmLanguage.json is based on https://github.com/textmate/latex.tmbundle/blob/master/Syntaxes/LaTeX.plist",
"but has been largely modified. The original file falls under the following license",
"",
"Permission to copy, use, modify, sell and distribute this",
"software is granted. This software is provided \"as is\" without",
"express or implied warranty, and with no claim as to its",
"suitability for any purpose.",
"",
"The file syntaxes/markdown-latex-combined.tmLanguage.json is generated from the Markdown grammar",
"included in VSCode and falls under the license described in markdown-latex-combined-license.txt.",
"",
"The file syntaxes/cpp-grammar-bailout.tmLanguage.json is generated from https://github.com/jeff-hykin/better-cpp-syntax",
"and falls under the license described in cpp-bailout-license.txt."
]
}
],
"version": 1
}
21 changes: 21 additions & 0 deletions extensions/latex/cpp-bailout-license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Jeff Hykin

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.
33 changes: 33 additions & 0 deletions extensions/latex/latex-cpp-embedded-language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"comments": {
"lineComment": "//",
"blockComment": ["/*", "*/"]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
{ "open": "[", "close": "]" },
{ "open": "{", "close": "}" },
{ "open": "(", "close": ")" },
{ "open": "'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "\"", "close": "\"", "notIn": ["string"] }
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"],
["<", ">"]
],
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)",
"folding": {
"markers": {
"start": "^\\s*#pragma\\s+region\\b",
"end": "^\\s*#pragma\\s+endregion\\b"
}
}
}
61 changes: 61 additions & 0 deletions extensions/latex/latex-language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"comments": {
"lineComment": "%"
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"],
["[", ")"],
["(", "]"],
["\\left(", "\\right)"],
["\\left(", "\\right."],
["\\left.", "\\right)"],
["\\left[", "\\right]"],
["\\left[", "\\right."],
["\\left.", "\\right]"],
["\\left\\{", "\\right\\}"],
["\\left\\{", "\\right."],
["\\left.", "\\right\\}"],
["\\left<", "\\right>"]
],
"autoClosingPairs": [
["\\left(", "\\right)"],
["\\left[", "\\right]"],
["\\left{", "\\right}"],
["\\bigl(", "\\bigr)"],
["\\bigl[", "\\bigr]"],
["\\bigl{", "\\bigr}"],
["\\Bigl(", "\\Bigr)"],
["\\Bigl[", "\\Bigr]"],
["\\Bigl{", "\\Bigr}"],
["\\biggl(", "\\biggr)"],
["\\biggl[", "\\biggr]"],
["\\biggl{", "\\biggr}"],
["\\Biggl(", "\\Biggr)"],
["\\Biggl[", "\\Biggr]"],
["\\Biggl{", "\\Biggr}"],
["\\(", "\\)"],
["\\[", "\\]"],
["\\{", "\\}"],
["{", "}"],
["[", "]"],
["(", ")"],
["`", "'"]
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"],
["`", "'"],
["$", "$"]
],
"indentationRules": {
"increaseIndentPattern": "\\\\begin{(?!document)([^}]*)}(?!.*\\\\end{\\1})",
"decreaseIndentPattern": "^\\s*\\\\end{(?!document)"
},
"autoCloseBefore": ";:.,=}])>\\` \n\t$",
"wordPattern": "([^\\s`'\"~_!?|$#@%^&*\\-=+;:,.<>(){}[\\]\\/]+)"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"comments": {
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": [
"<!--",
"-->"
]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"],
["[", ")"],
["(", "]"],
["\\left(", "\\right)"],
["\\left(", "\\right."],
["\\left.", "\\right)"],
["\\left[", "\\right]"],
["\\left[", "\\right."],
["\\left.", "\\right]"],
["\\left\\{", "\\right\\}"],
["\\left\\{", "\\right."],
["\\left.", "\\right\\}"],
["\\left<", "\\right>"]
],
"autoClosingPairs": [
["\\left(", "\\right)"],
["\\left[", "\\right]"],
["\\left{", "\\right}"],
["\\bigl(", "\\bigr)"],
["\\bigl[", "\\bigr]"],
["\\bigl{", "\\bigr}"],
["\\Bigl(", "\\Bigr)"],
["\\Bigl[", "\\Bigr]"],
["\\Bigl{", "\\Bigr}"],
["\\biggl(", "\\biggr)"],
["\\biggl[", "\\biggr]"],
["\\biggl{", "\\biggr}"],
["\\Biggl(", "\\Biggr)"],
["\\Biggl[", "\\Biggr]"],
["\\Biggl{", "\\Biggr}"],
["\\(", "\\)"],
["\\[", "\\]"],
["\\{", "\\}"],
["{", "}"],
["[", "]"],
["(", ")"],
["`", "'"]
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"],
["$", "$"],
["`", "`"],
["_", "_"],
["*", "*"],
],
"indentationRules": {
"increaseIndentPattern": "\\\\begin{(?!document)([^}]*)}(?!.*\\\\end{\\1})",
"decreaseIndentPattern": "^\\s*\\\\end{(?!document)"
},
"folding": {
"offSide": true,
"markers": {
"start": "^\\s*<!--\\s*#?region\\b.*-->",
"end": "^\\s*<!--\\s*#?endregion\\b.*-->"
}
},
"autoCloseBefore": ";:.,=}])>\\` \n\t$",
"wordPattern": "([^\\s`'\"~_!?|$#@%^&*\\-=+;:,.<>(){}[\\]\\/]+)"
}
21 changes: 21 additions & 0 deletions extensions/latex/markdown-latex-combined-license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Microsoft 2018

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.
111 changes: 111 additions & 0 deletions extensions/latex/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"name": "latex",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.0.0",
"publisher": "vscode",
"license": "MIT",
"engines": {
"vscode": "*"
},
"scripts": {
"update-grammar": "node ./build/update-grammars.js"
},
"contributes": {
"languages": [
{
"id": "tex",
"aliases": [
"TeX",
"tex"
],
"extensions": [
".sty",
".cls",
".bbx",
".cbx"
],
"configuration": "latex-language-configuration.json"
},
{
"id": "latex",
"aliases": [
"LaTeX",
"latex"
],
"extensions": [
".tex",
".ltx",
".ctx"
],
"configuration": "latex-language-configuration.json"
},
{
"id": "bibtex",
"aliases": [
"BibTeX",
"bibtex"
],
"extensions": [
".bib"
]
},
{
"id": "cpp_embedded_latex",
"configuration": "latex-cpp-embedded-language-configuration.json",
"aliases": []
},
{
"id": "markdown_latex_combined",
"configuration": "markdown-latex-combined-language-configuration.json",
"aliases": []
}
],
"grammars": [
{
"language": "tex",
"scopeName": "text.tex",
"path": "./syntaxes/TeX.tmLanguage.json"
},
{
"language": "latex",
"scopeName": "text.tex.latex",
"path": "./syntaxes/LaTeX.tmLanguage.json",
"embeddedLanguages": {
"source.cpp": "cpp_embedded_latex",
"source.css": "css",
"text.html": "html",
"source.java": "java",
"source.js": "javascript",
"source.julia": "julia",
"source.lua": "lua",
"source.python": "python",
"source.ruby": "ruby",
"source.ts": "typescript",
"text.xml": "xml",
"source.yaml": "yaml",
"meta.embedded.markdown_latex_combined": "markdown_latex_combined"
}
},
{
"language": "bibtex",
"scopeName": "text.bibtex",
"path": "./syntaxes/Bibtex.tmLanguage.json"
},
{
"language": "markdown_latex_combined",
"scopeName": "text.tex.markdown_latex_combined",
"path": "./syntaxes/markdown-latex-combined.tmLanguage.json"
},
{
"language": "cpp_embedded_latex",
"scopeName": "source.cpp.embedded.latex",
"path": "./syntaxes/cpp-grammar-bailout.tmLanguage.json"
}
]
},
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode.git"
}
}
4 changes: 4 additions & 0 deletions extensions/latex/package.nls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"displayName": "LaTeX Language Basics",
"description": "Provides syntax highlighting and bracket matching for TeX, LaTeX and BibTeX."
}
Loading

0 comments on commit 65a12fa

Please sign in to comment.