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.0.0 to 1.1.0

lib/service/command/RemoveSemicolons.d.ts

4

lib/checker.d.ts

@@ -1,2 +0,2 @@

import { SyntaxNode, Identifier, SyntaxKind, Graph, EdgeStatement, EdgeRhs, SourceFile, SubGraphStatement, NodeId, AttributeStatement } from "./types";
import { SyntaxNode, Identifier, SyntaxKind, Graph, EdgeStatement, EdgeRhs, SourceFile, SubGraphStatement, NodeId, AttributeStatement, Statement, StatementOf, Token } from "./types";
export declare function checkSourceFile(file: SourceFile): void;

@@ -6,2 +6,4 @@ export declare function findNodeAtOffset(root: SyntaxNode, offset: number): SyntaxNode | undefined;

export declare function findAllEdges(node: SyntaxNode): EdgeRhs[];
export declare function findOptionalSemicolons(node: SyntaxNode): Token<SyntaxKind.SemicolonToken>[];
export declare function findAllStatements<T extends Statement["kind"]>(node: SyntaxNode, kind?: T): StatementOf<T>[];
export declare function isAttrStatement(node: SyntaxNode): node is AttributeStatement;

@@ -8,0 +10,0 @@ export declare function isEdgeStatement(node: SyntaxNode): node is EdgeStatement;

@@ -73,2 +73,28 @@ "use strict";

exports.findAllEdges = findAllEdges;
function findOptionalSemicolons(node) {
const statements = findAllStatements(node);
const terminators = statements.map(p => p.terminator);
return terminators.filter(t => !!t);
}
exports.findOptionalSemicolons = findOptionalSemicolons;
function isStatement(node) {
return node.kind === types_1.SyntaxKind.SubGraphStatement
|| node.kind === types_1.SyntaxKind.EdgeStatement
|| node.kind === types_1.SyntaxKind.NodeStatement
|| node.kind === types_1.SyntaxKind.IdEqualsIdStatement
|| node.kind === types_1.SyntaxKind.AttributeStatement;
}
function findAllStatements(node, kind) {
const allStatements = [];
visitor_1.forEachChild(node, child => {
if ((kind === undefined && isStatement(child)) || (child.kind === kind)) {
allStatements.push(child);
}
const childStatements = findAllStatements(child, kind);
if (childStatements && childStatements.length > 0)
allStatements.push.apply(allStatements, childStatements);
});
return allStatements;
}
exports.findAllStatements = findAllStatements;
function findEdgeErrors(expectedEdgeOp, node) {

@@ -75,0 +101,0 @@ const edges = findAllEdges(node);

import * as lst from "vscode-languageserver-types";
import { DocumentLike, SourceFile, CommandApplication } from "../";
import { ExecutableCommand } from "./command/common";
export declare function getCodeActions(doc: DocumentLike, sourceFile: SourceFile, range: lst.Range, context: lst.CodeActionContext): lst.Command[] | undefined;
export declare function getCodeActions(doc: DocumentLike, sourceFile: SourceFile, range: lst.Range, context?: lst.CodeActionContext): lst.Command[] | undefined;
export declare const enum CommandIds {

@@ -9,4 +9,5 @@ ChangeEdgeOp = "DOT.changeEdgeOp",

ConsolidateDescendants = "DOT.consolidateDescendants",
RemoveSemicolons = "DOT.removeSemicolons",
}
export declare function getAvailableCommands(): string[];
export declare function executeCommand(doc: DocumentLike, sourceFile: SourceFile, cmd: ExecutableCommand): CommandApplication | undefined;

@@ -9,2 +9,3 @@ "use strict";

const ConsolidateDescendantsCommand = require("./command/ConsolidateDescendantsCommand");
const RemoveSemicolonsCommand = require("./command/RemoveSemicolons");
const common_1 = require("./command/common");

@@ -59,2 +60,5 @@ function getCodeActions(doc, sourceFile, range, context) {

if (clickedNode && !!clickedNode.parent) {
if (clickedNode.kind === _1.SyntaxKind.SemicolonToken) {
res.push(RemoveSemicolonsCommand.create());
}
if (_1.isIdentifierNode(clickedNode)) {

@@ -182,2 +186,3 @@ clickedNode = clickedNode.parent;

["DOT.consolidateDescendants"]: ConsolidateDescendantsCommand.execute,
["DOT.removeSemicolons"]: RemoveSemicolonsCommand.execute,
};

@@ -184,0 +189,0 @@ function getAvailableCommands() {

@@ -393,1 +393,2 @@ export declare const enum ErrorSource {

export declare type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
export declare type StatementOf<T extends Statement["kind"]> = T extends SyntaxKind.SubGraphStatement ? SubGraphStatement : T extends SyntaxKind.AttributeStatement ? AttributeStatement : T extends SyntaxKind.EdgeStatement ? EdgeStatement : T extends SyntaxKind.IdEqualsIdStatement ? IdEqualsIdStatement : T extends SyntaxKind.NodeStatement ? NodeStatement : never;
{
"name": "dot-language-support",
"version": "1.0.0",
"version": "1.1.0",
"description": "Parser and language service for graphviz (dot) files",

@@ -10,3 +10,3 @@ "author": "Niklas Mollenhauer",

"scripts": {
"test": "mocha -r ts-node/register tests/**/*.spec.ts",
"test": "mocha -r ts-node/register tests/**/*.spec.ts tests/*.spec.ts",
"clean": "rm -rv -- lib/* || true",

@@ -24,2 +24,6 @@ "compile": "tsc",

],
"repository": {
"type": "git",
"url": "https://github.com/nikeee/dot-language-support.git"
},
"dependencies": {

@@ -34,3 +38,4 @@ "vscode-languageserver-types": "^3.7.2"

"ts-node": "^6.0.5",
"typescript": "^2.8.3"
"typescript": "^2.8.3",
"vscode-languageserver": "^4.1.3"
},

@@ -37,0 +42,0 @@ "engines": {

@@ -1,2 +0,3 @@

# dot-language-support [![Build Status](https://travis-ci.com/nikeee/gv-ls.svg?token=4EmEjSohQak8cB3EMcq5&branch=master)](https://travis-ci.com/nikeee/dot-language-support)
# dot-language-support
> [![Build Status](https://travis-ci.com/nikeee/dot-language-support.svg?branch=master)](https://travis-ci.com/nikeee/dot-language-support) ![Dependency Status](https://david-dm.org/nikeee/dot-language-support.svg) [![npm version](https://badge.fury.io/js/dot-language-support.svg)](https://www.npmjs.com/package/dot-language-support)

@@ -3,0 +4,0 @@ A language service library, written in TypeScript. Used by [dot-language-server](https://github.com/nikeee/dot-language-server) and [edotor.net](https://edotor.net).

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