Skip to content

Commit

Permalink
Enable syntax highlighting for URDFs (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
IsabelParedes authored Oct 11, 2022
1 parent 9b51fbd commit 3602f83
Show file tree
Hide file tree
Showing 3 changed files with 338 additions and 3 deletions.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"dependencies": {
"@jupyterlab/application": "^3.4.0",
"@jupyterlab/apputils": "^3.4.0",
"@jupyterlab/codemirror": "^3.4.8",
"@jupyterlab/docregistry": "^3.4.0",
"@jupyterlab/filebrowser": "^3.4.0",
"@jupyterlab/launcher": "^3.4.0",
Expand All @@ -66,10 +67,11 @@
"@lumino/messaging": "^1.10.0",
"@lumino/signaling": "^1.10.0",
"@lumino/widgets": "^1.30.0",
"amphion": "npm:@robostack/amphion@^0.1.25",
"roslib": "npm:@robostack/roslib@^1.1.1",
"@types/codemirror": "^5.60.5",
"@types/dat.gui": "^0.7.7",
"dat.gui": "^0.7.9"
"amphion": "npm:@robostack/amphion@^0.1.25",
"dat.gui": "^0.7.9",
"roslib": "npm:@robostack/roslib@^1.1.1"
},
"devDependencies": {
"@babel/core": "^7.0.0",
Expand Down
12 changes: 12 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ import { UrdfWidgetFactory } from './factory';

import { urdf_icon } from './icons';

// For syntax highlighting
import { Mode } from '@jupyterlab/codemirror';

// Name of the factory that creates the URDF widgets
const FACTORY = 'URDF Widget Factory';

Expand Down Expand Up @@ -90,6 +93,14 @@ const extension: JupyterFrontEndPlugin<void> = {
tracker.add(widget);
});

// Syntax highlighting
Mode.getModeInfo().push({
name: 'URDF',
mime: 'text/xml',
mode: 'xml',
ext: ['urdf', 'xacro']
});

// Register widget and model factories
app.docRegistry.addWidgetFactory(widgetFactory);

Expand All @@ -101,6 +112,7 @@ const extension: JupyterFrontEndPlugin<void> = {
iconClass: 'jp-URDFIcon',
fileFormat: 'text',
contentType: 'file',
mimeTypes: ['application/xml', 'text/xml'],
icon: urdf_icon
});

Expand Down
Loading

0 comments on commit 3602f83

Please sign in to comment.