Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dot-language-support

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dot-language-support - npm Package Compare versions

Comparing version 1.1.8 to 1.1.9

2

lib/checker.d.ts
import { SyntaxNode, Identifier, SyntaxKind, Graph, EdgeStatement, EdgeRhs, SourceFile, SubGraphStatement, NodeId, AttributeStatement, Statement, StatementOf, Token } from "./types";
export declare function checkSourceFile(file: SourceFile): void;
export declare function findNodeAtOffset(root: SyntaxNode, offset: number): SyntaxNode | undefined;
export declare function findNodeAtOffset(root: SyntaxNode, offset: number, inclusiveEnd?: boolean): SyntaxNode | undefined;
export declare function getAllowedEdgeOperation(graph: Graph): SyntaxKind.DirectedEdgeOp | SyntaxKind.UndirectedEdgeOp;

@@ -5,0 +5,0 @@ export declare function findAllEdges(node: SyntaxNode): EdgeRhs[];

@@ -26,20 +26,13 @@ "use strict";

}
function rangeContainsOffset(range, offset) {
return range.pos <= offset && offset <= range.end;
function rangeContainsOffset(range, offset, inclusiveEnd) {
return inclusiveEnd
? range.pos <= offset && offset <= range.end
: range.pos <= offset && offset < range.end;
}
function findNodeAtOffset(root, offset) {
if (rangeContainsOffset(root, offset)) {
let candidate = root;
visitor_1.forEachChild(root, n => {
const r = findNodeAtOffset(n, offset);
if (r && (candidate.end - candidate.end) < (root.end - root.pos))
candidate = r;
}, ns => {
for (const n of ns) {
const r = findNodeAtOffset(n, offset);
if (r && (candidate.end - candidate.end) < (root.end - root.pos))
candidate = r;
}
});
return candidate;
function findNodeAtOffset(root, offset, inclusiveEnd = false) {
if (root.pos === offset && root.pos === root.end)
return root;
if (rangeContainsOffset(root, offset, inclusiveEnd)) {
const narrowerChild = visitor_1.forEachChild(root, child => findNodeAtOffset(child, offset, inclusiveEnd));
return narrowerChild ? narrowerChild : root;
}

@@ -46,0 +39,0 @@ return undefined;

@@ -16,6 +16,6 @@ "use strict";

const offset = doc.offsetAt(position);
const node = checker_1.findNodeAtOffset(g, offset);
const node = checker_1.findNodeAtOffset(g, offset, true);
if (!node)
return [];
const prevNode = checker_1.findNodeAtOffset(g, node.pos - 1);
const prevNode = checker_1.findNodeAtOffset(g, node.pos - 1, true);
if (!prevNode)

@@ -22,0 +22,0 @@ return [];

{
"name": "dot-language-support",
"version": "1.1.8",
"version": "1.1.9",
"description": "Parser and language service for graphviz (dot) files",

@@ -5,0 +5,0 @@ "author": "Niklas Mollenhauer",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc