Giter Site home page Giter Site logo

edgedb / edgedb-editor-plugin Goto Github PK

View Code? Open in Web Editor NEW
33.0 10.0 5.0 671 KB

EdgeDB plugin for Sublime Text, Atom, and VSCode

Home Page: https://edgedb.com

License: MIT License

Makefile 0.34% Python 4.88% JavaScript 53.73% EdgeQL 36.26% TypeScript 4.78%
sublime-text-3 vscode-extension atom atom-package atom-editor vscode sublime-text-plugin edgedb edgeql

edgedb-editor-plugin's Introduction

EdgeDB Editor Plugin Build Status

This is a package with syntax highlighter for EdgeDB languages: EdgeQL and ESDL (EdgeDB Schema Definition Language). The plugin is designed to work with Sublime Text, Atom and Visual Studio Code.

(The color scheme used in the screenshot is Chromodynamics.)

Installation

In Atom and Visual Studio Code install the EdgeDB package.

In Sublime Text, install the EdgeDB package via "Package Control".

Contributing

We are accepting pull requests for anything that improves this extension: new features, fixes or documentation. We are not accepting code refactors.

Publishing

To publish a new version:

  • increment the version number in package.json to e.g. 0.1.8,
  • commit and tag the changes with tag of format v0.1.8,
  • push to GitHub.

This will start the GitHub Action that will publish to the Azure Marketplace.

To publish a prerelease version, tag the commit with v0.1.8-pre. Do not add -pre to the version in package.json. A regular release cannot have the same number as the prerelease version, so (at least) the patch number must be increased. For example, after publishing v0.1.8-pre, we would publish v0.1.9.

edgedb-editor-plugin's People

Contributors

1st1 avatar aljazerzen avatar coreyward avatar dreglad avatar elprans avatar lsdch avatar vpetrovykh avatar zth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

edgedb-editor-plugin's Issues

eschema now has case insensitive keywords

CONCEPT AbstractConstraintParent:
    link name TO str:
        Delegated constraint unique

is just as valid as

concept AbstractConstraintParent:
    link name to str:
        delegated constraint unique

Requires VSCode restart after a schema migration

We received this review on the VSCode extension marketplace:

Excellent. The only issue is it seems to require the program to be restarted each time a database migration occurs.

Is there anything we can do to mitigate this?

im haveing trouble deleteing an extra 'const createPool = edged.createPool'

whenever i delete the 2nd 'const createPool = edged.createPool' it breaks my code any advice on how to fix it? im only haveing it send call logs to the database

`const { createPool } = require('edgedb');

if (!crypto.timingSafeEqual(calculatedTag, authTag)) {
throw new Error('Message authentication failed');
}

class RtcSignalingService extends Service {
constructor(options) {
super(options);
this.sessions = {};
}

async create(data, params) {
    const { sessionId, offer } = data;
    const { user } = params;
    this.sessions[sessionId] = {
        caller: user._id,
        startTime: new Date(), //record the start time
    };

    if (!this.sessions[sessionId]) {
        this.sessions[sessionId] = { caller: user._id };
    } else {
        this.sessions[sessionId].callee = user._id;
    }

    const session = this.sessions[sessionId];
    const otherUserId = session.caller === user._id ? session.callee : session.caller;

    this.app.channel(`user/${otherUserId}`).send({
        event: 'offer',
        offer,
        from: user._id,
        sessionId,
    });

    return { sessionId };
}

async patch(id, data, params) {
    const { sessionId, answer } = data;
    const { user } = params;

    const session = this.sessions[sessionId];
    const otherUserId = session.caller === user._id ? session.callee : session.caller;

    this.app.channel(`user/${otherUserId}`).send({
        event: 'answer',
        answer,
        from: user._id,
        sessionId,
    });

    return {};
}

async remove(id, params) {
    const { sessionId } = params.query;
    const session = this.sessions[sessionId];
    await this.insertCallRecord(
        sessionId,
        session.caller,
        session.callee,
        session.startTime,
        new Date() //Record the end time
    );
    delete this.sessions[sessionId];
    return {};
}

async insertCallRecord(sessionId, callerId, calleeId, startTime, endTime) {
    const query = `
        INSERT Call {
            sessionId := <uuid>$sessionId,
            caller := (SELECT User FILTER .id = <uuid>$callerId),
            callee := (SELECT User FILTER .id = <uuid>$calleeId),
            startTime := <datetime>$startTime,
            endTime := <datetime>$endTime,
        }
    `;
    const connectionPool = createPool({
        host: process.env.HOST,
        port: process.env.PORT,
        user: process.env.ADMIN,
        password: process.env.PASSWORD,
        database: process.env.VOICE_LOGS
    });
    await connectionPool.query(query, {
        sessionId,
        callerId,
        calleeId,
        startTime,
        endTime,
    });
}

}

module.exports = function(app) {
app.use('/rtc-signaling', new RtcSignalingService());
};

//on caller side
const session = this.sessions[sessionId];
const otherUserId = session.caller === user._id ? session.callee : session.caller;
const callerOffer = await pc.createOffer();
await pc.setLocalDescription(callerOffer);

//send the offer to the other party via signaling server
this.app.channel(user/${otherUserId}).send({
event: 'offer',
offer: callerOffer.toJSON(),
from: user._id,
sessionId,
});

// On the callee side:
const { from: incomingOtherUserId, sessionId } = data;
const calleeOffer = new RTCSessionDescription(data.offer);
await pc.setRemoteDescription(calleeOffer);
const answer = await pc.createAnswer();
await pc.setLocalDescription(answer);

//send the answer to the caller via the signaling server
this.app.channel(user/${otherUserId}).send({
event: 'answer',
answer: answer.toJSON(),
from: user._id,
sessionId,
});

const createPool = edged.createPool
calllogs
`

highlight `on (edgeql syntax)`

concept AbstractConstraintParent2:
    link name to str:
        delegated constraint unique on (lower(subject))

lower(subject) should be highlighted as EdgeQL

Drop support for old attributes syntax

I.e. we no longer support

concept AAA:
  title: 'bbb'

^ a := operator should have been used there.

I'm not sure if we want to do anything special about this, but if there're some specific rules to highlight the above, they should be removed now.

Add more highlighter tests

More tests are needed for both EdgeQL and eschema highlighters.

eschema:

  • test all keywords
  • atom
  • concept
  • link
  • linkproperty

EdgeQL:

  • DDL syntax
  • WITH
  • SELECT
  • GROUP
  • UPDATE
  • INSERT
  • DELETE

Not working + feature request

Idk why but it doesnt work

My color scheme is: Bearded Themes Black & Ruby
VSCode Version: 1.68.1

(My feature request is that edgedb extension works as an formatter in its schema files)
image

eschema syntax highlight crashes in atom-1.22

Steps to reproduce:

  1. Open any *.eschema file in atom-1.22.0

Atom: 1.22.0 x64
dev-libs/oniguruma: 6.6.1
Electron: 1.6.15
OS: linux 4.14.0-rc8-00016-g64ba914f196d
Thrown From: Atom Core

Stack Trace

Uncaught Error: invalid pattern in look-behind

At /usr/lib64/atom/app.asar/node_modules/first-mate/lib/scanner.js:31

Error: invalid pattern in look-behind
    at Scanner.module.exports.Scanner.createScanner (/app.asar/node_modules/first-mate/lib/scanner.js:31:24)
    at Scanner.module.exports.Scanner.getScanner (/app.asar/node_modules/first-mate/lib/scanner.js:37:31)
    at Scanner.module.exports.Scanner.findNextMatch (/app.asar/node_modules/first-mate/lib/scanner.js:56:22)
    at Rule.module.exports.Rule.findNextMatch (/app.asar/node_modules/first-mate/lib/rule.js:98:28)
    at Rule.module.exports.Rule.getNextTags (/app.asar/node_modules/first-mate/lib/rule.js:154:21)
    at Grammar.module.exports.Grammar.tokenizeLine (/app.asar/node_modules/first-mate/lib/grammar.js:152:44)
    at TokenizedBuffer.buildTokenizedLineForRowWithText (/app.asar/src/tokenized-buffer.js:506:44)
    at TokenizedBuffer.buildTokenizedLineForRow (/app.asar/src/tokenized-buffer.js:501:17)
    at TokenizedBuffer.tokenizeNextChunk (/app.asar/src/tokenized-buffer.js:389:41)
    at _.defer (/app.asar/src/tokenized-buffer.js:373:57)
    at /app.asar/node_modules/underscore/underscore.js:666:47

Comment syntax highlighting inside type syntax

Comment A is not highlighted in the following query,

with  examples := <array<tuple<
    x: str,
    y: str, # Comment A
  >>>$examples,

for e in array_unpack(examples) union (
  insert Example {
    x:=e.x, #Comment B
    y:=e.y
  }
)
Screenshot 2023-09-19 at 1 42 46 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.