@codenav/codenav
v0.0.2
Published
Node.js bindings for CodeNav.
Downloads
17
Readme
CodeNav Node.js Bindings
Node.js bindings for CodeNav.
Installation
npm install @codenav/codenav
Quick Start
import * as codenav from '@codenav/codenav';
const nav = new codenav.Navigator(codenav.Language.Python, './test.sqlite');
nav.index(['<YOUR_LOCAL_PATH>/codenav/examples/python'], false);
const reference = {path: '<YOUR_LOCAL_PATH>/codenav/examples/python/chef.py', line: 2, column: 0, text: 'broil'};
const definitions = nav.resolve(reference);
for (let d of definitions) {
console.log(`${d.path}:${d.span.start.line}:${d.span.start.column}`);
console.log(d.text(codenav.TextMode.Complete));
}
nav.clean(true);
Examples
- Resolve a Python reference
- Resolve a Python snippet
- Resolve a JavaScript reference
- Resolve a JavaScript snippet
- Resolve a TypeScript reference
- Resolve a TypeScript snippet
Development
Install napi-rs:
npm install -g @napi-rs/cli
Build the native package:
napi build --platform --release
Run the examples:
node examples/resolve_python_reference.js
node examples/resolve_python_snippet.js
node examples/resolve_javascript_reference.js
node examples/resolve_javascript_snippet.js
node examples/resolve_typescript_reference.js
node examples/resolve_typescript_snippet.js