diff --git a/CHANGELOG.md b/CHANGELOG.md index d6826ff..f57aa5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,3 +30,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - fixed mol2,frcmod bugs - fixed pdb/psf highlight by section (begin/end but keyword cannot be highlighted) problem +### 0.0.6 + +- add hdb, r2b, tdb, arn + diff --git a/README.md b/README.md index 5bd80d0..d1138ea 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,21 @@ # md-highlighter README -`md-highlighter` is a simple extension to highlight files about molecular modeling and molecular dynamics simulation. Specially, it supports NAMD/CHARMM and some of Amber file formats. +`md-highlighter` is a simple extension to highlight the most various file types about molecular modeling and molecular dynamics simulation. This extension provides comprehensive coverage of commonly used file formats under various popular tools, including Gromacs, Amber, AmberTools, NAMD, VMD, and more. It also performs detailed keyword parsing, helping users to locate and edit information within files more quickly. Users can even identify syntax errors quickly based on different display colors. Feel free to download and try it out, and don't hesitate to recommend it to your colleagues! ## Features Supported format: - NAMD: rtf, pdb, prm, psf, str, inp -- Amber: in, prmtop, inpcrd, prepin, frcmod -- Gromacs: gro, atp, rtp, mtp (pmx), ... +- Amber: in, prmtop, inpcrd, prepin, frcmod, lib/off, ac, mc +- Gromacs: gro, atp, arn, rtp, hdb, r2b, tdb, mtp (pmx), ... - small molecule: sdf, mol2 (modified from gromacs helper), ... - PLUMED: .plumed.dat -- upcoming: (AmberTools leap), lib,... -For gromacs-related files, please install `gromacs-helper`. For VMD, install `TCL`. For Gaussian, install `Gaussian Input File (gjf)`. But maybe I'll make my own syntaxes. +For gromacs `.top`/`.itp` files, you may also install `gromacs-helper`. For VMD, install `TCL`. For Gaussian, install `Gaussian Input File (gjf)`. But maybe I make my own syntaxes. Tested in theme "Atom One Light". -This extension is created with the help of ChatGPT and New Bing. - ## Gallery Install to explore more file types! @@ -42,7 +39,7 @@ Install to explore more file types! ## Conventions - variable.other.residue-number (except psf,gro) -- entity.name.type.residue-name +- entity.name.type.residue-name (except hdb) - constant.numeric.atom-number (except gro,lib) - entity.name.tag.atom-name - support.type.atom-type @@ -79,6 +76,8 @@ TODO: - add self-defined colors like pink, etc. - sdf file? +This extension is created with the help of ChatGPT and New Bing in the beginning. + ## Release Notes see CHANGELOG diff --git a/package.json b/package.json index f33cd22..34a97f8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "md-highlighter", "displayName": "md-highlighter", "description": "Highlighting files about molecular modeling and dynamics simulation.", - "version": "0.0.5", + "version": "0.0.6", "publisher": "gxf1212", "repository": "https://github.com/gxf1212/md-highlighter", "engines": { @@ -16,7 +16,7 @@ "languages": [{ "id": "rtf", "aliases": ["NAMD force field", "rtf"], - "extensions": [".rtf", ".str", ".inp", ".prm"], + "extensions": [".rtf", ".str", ".inp", ".prm", ".par"], "configuration": "./language-configuration.json" }, { @@ -41,13 +41,13 @@ { "id": "prmtop", "aliases": ["Amber topology file", "prmtop"], - "extensions": [".prmtop", "parm7"], + "extensions": [".prmtop", ".parm7"], "configuration": "./language-configuration.json" }, { "id": "inpcrd", "aliases": ["Amber coordinate file", "inpcrd"], - "extensions": [".inpcrd", "rst7"], + "extensions": [".inpcrd", ".rst7"], "configuration": "./language-configuration.json" }, { @@ -75,6 +75,12 @@ "extensions": [".ac", ".AC"], "configuration": "./language-configuration.json" }, + { + "id": "mc", + "aliases": ["Antechamber mainchain file"], + "extensions": [".mc"], + "configuration": "./language-configuration.json" + }, { "id": "gro", "aliases": ["Gromacs coordinate file"], @@ -87,11 +93,35 @@ "extensions": [".atp"], "configuration": "./language-configuration.json" }, + { + "id": "arn", + "aliases": ["Gromacs atom renaming specification"], + "extensions": [".arn"], + "configuration": "./language-configuration.json" + }, { "id": "rtp", "aliases": ["Gromacs residue type file"], "extensions": [".rtp"], "configuration": "./language-configuration.json" + }, + { + "id": "hdb", + "aliases": ["Gromacs hydrogen database"], + "extensions": [".hdb"], + "configuration": "./language-configuration.json" + }, + { + "id": "r2b", + "aliases": ["Gromacs r2b file"], + "extensions": [".r2b"], + "configuration": "./language-configuration.json" + }, + { + "id": "tdb", + "aliases": ["Gromacs terminal database"], + "extensions": [".tdb"], + "configuration": "./language-configuration.json" }, { "id": "mtp", @@ -167,6 +197,11 @@ "scopeName": "source.ac", "path": "./syntaxes/ac.tmLanguage.json" }, + { + "language": "mc", + "scopeName": "source.mc", + "path": "./syntaxes/mc.tmLanguage.json" + }, { "language": "gro", "scopeName": "source.gro", @@ -177,11 +212,31 @@ "scopeName": "source.atp", "path": "./syntaxes/atp.tmLanguage.json" }, + { + "language": "arn", + "scopeName": "source.arn", + "path": "./syntaxes/arn.tmLanguage.json" + }, { "language": "rtp", "scopeName": "source.rtp", "path": "./syntaxes/rtp.tmLanguage.json" }, + { + "language": "hdb", + "scopeName": "source.hdb", + "path": "./syntaxes/hdb.tmLanguage.json" + }, + { + "language": "r2b", + "scopeName": "source.r2b", + "path": "./syntaxes/r2b.tmLanguage.json" + }, + { + "language": "tdb", + "scopeName": "source.tdb", + "path": "./syntaxes/tdb.tmLanguage.json" + }, { "language": "mtp", "scopeName": "source.mtp", diff --git a/syntaxes/arn.tmLanguage.json b/syntaxes/arn.tmLanguage.json new file mode 100644 index 0000000..fbc4762 --- /dev/null +++ b/syntaxes/arn.tmLanguage.json @@ -0,0 +1,33 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "arn", + "scopeName": "source.arn", + "fileTypes": [ + "arn" + ], + "patterns": [ + { + "name": "comment.line.semicolon", + "match": ";.*$" + }, + { + "name": "constant.numberic.arn", + "match": "-?\\d+\\.\\d*" + }, + { + "//": "the word after RESI|PRES", + "name": "entity.name.type.residue-name.rtf", + "match": "(?<=^\\s*)\\S+" + }, + { + "//": "add (4/5, after two numbers), improper (4)", + "name": "entity.name.tag.atom-name.tdb", + "match": "(?<=^\\s*\\S+\\s*)[0-9]*[A-Z]+[A-Z0-9_'*]*" + }, + { + "//": "all strings made up of capitalized letters and numbers. matching a lot of remaining strings...including dihedral n", + "name": "support.type.atom-type.arn", + "match": "(?<=^\\s*\\S+\\s*[0-9]*[A-Z]+[A-Z0-9_'*]*\\s*)[0-9]*[A-Z]+[A-Z0-9_'*]*" + } + ] +} \ No newline at end of file diff --git a/syntaxes/hdb.tmLanguage.json b/syntaxes/hdb.tmLanguage.json new file mode 100644 index 0000000..162fe89 --- /dev/null +++ b/syntaxes/hdb.tmLanguage.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "Gromacs hdb file", + "scopeName": "source.hdb", + "fileTypes": [ + "hdb" + ], + "patterns": [ + { + "name": "comment.line.exclamation", + "match": ";.*$" + }, + { + "name": "support.type.residue-name.hdb", + "match": "(?<=^)\\S+(?=\\s*\\d+\\s*$)" + }, + { + "name": "string.other.count.hdb", + "match": "(?<=^\\S+\\s*)\\d+(?=\\s*$)" + }, + { + "name": "entity.name.tag.atom-name.hdb", + "match": "(?<=^\\d+\\s+\\d+\\s+)\\S+\\s+\\S+(\\s+\\S+\\s+\\S+)?(\\s+\\S+)?(?=\\s*$)" + }, + { + "name": "constant.numeric.hdb", + "match": "\\b\\d+\\b|(?<=^\\s*)\\d+|(\\b|\\-)\\d+\\.?\\d*([eE][\\+\\-]?\\d+)?" + } + ] +} \ No newline at end of file diff --git a/syntaxes/mc.tmLanguage.json b/syntaxes/mc.tmLanguage.json new file mode 100644 index 0000000..e5ad942 --- /dev/null +++ b/syntaxes/mc.tmLanguage.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "mc", + "scopeName": "source.mc", + "fileTypes": [ + "mc" + ], + "patterns": [ + { + "match": "HEAD_NAME|TAIL_NAME|PRE_HEAD_TYPE|POST_TAIL_TYPE|CHARGE", + "name": "keyword.other.mc" + }, + { + "match": "OMIT_NAME", + "name": "string.other.mc" + }, + { + "name": "entity.name.tag.atom-name.mc", + "match": "(?<=NAME\\s*)\\b\\S+\\b" + }, + { + "name": "support.type.atomtype.mc", + "match": "(?<=TYPE\\s*)\\b\\S+\\b" + }, + { + "name": "constant.numeric.mc", + "match": "\\b(-?\\d*\\.\\d*)\\b|\\b\\d+\\b" + } + ] +} \ No newline at end of file diff --git a/syntaxes/r2b.tmLanguage.json b/syntaxes/r2b.tmLanguage.json new file mode 100644 index 0000000..441518b --- /dev/null +++ b/syntaxes/r2b.tmLanguage.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "Gromacs r2b file", + "scopeName": "source.r2b", + "fileTypes": [ + "r2b" + ], + "patterns": [ + { + "name": "comment.line.exclamation", + "match": ";.*$" + }, + { + "name": "entity.name.type.residue-name.r2b", + "match": "\\S+" + }, + { + "name": "constant.numeric.r2b", + "match": "\\b\\d+\\b|(?<=^\\s*)\\d+|(\\b|\\-)\\d+\\.?\\d*([eE][\\+\\-]?\\d+)?" + } + ] +} \ No newline at end of file diff --git a/syntaxes/rtf.tmLanguage.json b/syntaxes/rtf.tmLanguage.json index 1bd363c..112849a 100644 --- a/syntaxes/rtf.tmLanguage.json +++ b/syntaxes/rtf.tmLanguage.json @@ -20,11 +20,11 @@ }, { "name": "keyword.rtf", - "match": "\\b(MASS|RESI|PRES|DELETE|ATOM|BOND|ANGLE(S)?|DIHE(DRAL)?|IMPR|(?i)IC|BILD|ACCE(PTOR)?|DONO(R)?|DOUBLE|DOUB|(?i)PATC(H)?|PATCHING|LONEPAIR|COLI|DIST|SCAL|DECL|DEFA|AUTO|FIRS|LAST|first|last|default)\\b" + "match": "\\b(MASS|RESI|PRES|DELETE|ATOM|BOND|ANGLE(S)?|DIHE(DRAL)?|IMPR|IMPH|(?i)IC|BILD|ACCE(PTOR)?|DONO(R)?|DOUBLE|DOUB|(?i)PATC(H)?|PATCHING|LONEPAIR|COLI|DIST|SCAL|DECL|DEFA|AUTO|FIRS|LAST|first|last|default)\\b" }, { "name": "keyword.prm", - "match": "(MASS|ATOMS|BONDS|ANGLES|DIHEDRALS|IMPROPERS|CMAP|NONBONDED|NBFIX|HBOND|CUTHB)" + "match": "(MASS|ATOMS|BONDS|ANGLES|DIHEDRALS|IMPROPER(S)?|CMAP|NONBONDED|NBFIX|HBOND|CUTHB)" }, { "name": "entity.name.section.prm", @@ -64,7 +64,7 @@ "note": "bond: variable length of pairs; impr: four strings", "///": "Maybe atom names can be de", "name": "entity.name.tag.atom.rtf", - "match": "(?<=\\bATOM\\s*)\\S+|(?<=\\bBOND\\s*)(\\S+\\s+\\S+\\s*)+|(?<=\\bANGLE\\s*)((\\S+\\s*){3})+|(?<=\\bIMPR\\s*)((\\S+\\s*){4})+|(?<=\\bCMAP\\s*)((\\S+\\s*){8})+|(?<=\\b\\s*(?i)IC\\s*)(\\S+\\s+){4}|(?<=\\b\\s*BILD\\s*)(\\S+\\s+){4}" + "match": "(?<=\\bATOM\\s*)\\S+|(?<=\\bBOND\\s*)(\\S+\\s+\\S+\\s*)+|(?<=\\bANGLE\\s*)((\\S+\\s*){3})+|(?<=\\bIMPR\\s*)((\\S+\\s*){4})+|(?<=\\bIMPH\\s*)((\\S+\\s*){4})+|(?<=\\bCMAP\\s*)((\\S+\\s*){8})+|(?<=\\b\\s*(?i)IC\\s*)(\\S+\\s+){4}|(?<=\\b\\s*BILD\\s*)(\\S+\\s+){4}" }, { "//": "the several words after a keyword.", diff --git a/syntaxes/tdb.tmLanguage.json b/syntaxes/tdb.tmLanguage.json new file mode 100644 index 0000000..c605ba0 --- /dev/null +++ b/syntaxes/tdb.tmLanguage.json @@ -0,0 +1,47 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "Gromacs terminal database", + "scopeName": "source.tdb", + "fileTypes": [ + "tdb" + ], + "patterns": [ + { + "name": "comment.line.semicolon", + "match": ";.*$" + }, + { + "//": "section", + "match": "\\[.*\\]", + "name": "entity.name.class" + }, + { + "//": "deltete (one space); replace (before type mass charge)", + "name": "entity.name.tag.atom-name.tdb", + "match": "(?<=^\\s)[0-9]*[A-Z]+[A-Z0-9_']*|[0-9]*[A-Z]+[A-Z0-9_']*(?=\\s+[0-9]*[A-Z]+[A-Z0-9_'*]*\\s+-?\\d+\\.\\d*)" + }, + { + "//": "add (4/5, after two numbers), improper (4)", + "name": "entity.name.tag.atom-name2.tdb", + "match": "(\\s*-?\\+?[0-9]*[A-Z]+[A-Z0-9_'\\+]*){4}(\\s*-?\\+?[0-9]*[A-Z]+[A-Z0-9_'\\+]*)?" + }, + { + "//": "after atom name, match any of these strings", + "name": "support.type.atom-type.tdb", + "match": "[0-9]*[A-Z]+[A-Z0-9_'*]*(?=\\s+-?\\d+\\.\\d*)" + }, + { + "name": "constant.numeric.atomic-mass.tdb", + "match": "(?<=[0-9]*[A-Z]+[A-Z0-9_'*]*\\s+)-?\\d+\\.\\d*" + }, + { + "name": "string.quoted.charge.tdb", + "match": "(?<=[0-9]*[A-Z]+[A-Z0-9_'*]*\\s+-?\\d+\\.\\d*\\s+)-?\\d+\\.\\d*" + }, + { + "//": "number", + "match": "(\\b|\\-)\\d+\\.?\\d*([eE][\\+\\-]?\\d+)?", + "name": "constant.language.tdb" + } + ] +} \ No newline at end of file