Giter VIP home page Giter VIP logo

language-sql's Introduction

Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our official announcement

SQL language support in Atom

CI

Adds syntax highlighting to SQL files in Atom.

Originally converted from the SQL TextMate bundle.

Contributions are greatly appreciated. Please fork this repository and open a pull request to add snippets, make grammar tweaks, etc.

language-sql's People

Contributors

50wliu avatar abahgat avatar c-bouthoorn avatar caged avatar caleb531 avatar calvinhartwell avatar chbk avatar damieng avatar darangi avatar diesire avatar duanefields avatar dwroblewski avatar ekeitho avatar erikbrinkman avatar gontadu avatar inohiro avatar jasonrudolph avatar jeremiahpslewis avatar joelmichael avatar kevinsawicki avatar lee-dohm avatar lexluengas avatar lmorganjr avatar mattiascibien avatar michaelsanford avatar mnquintana avatar postcasio avatar sadick254 avatar torn4dom4n avatar zincbehemoth 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  avatar  avatar  avatar  avatar  avatar

Watchers

 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

language-sql's Issues

Trigger / Procedure related keywords

Could trigger / procedure related keywords be implemented?
Here are a couple of them:

before delete on
after delete on
before update on
after update on
before insert on
after insert on

for each row
execute procedure
returns trigger
return
language plpgsql

perform
raise exception

if
elsif
else
end if

Thanks!

Create additional grammars for SAP HANA2 on Cloud

Dear all

I work with SAP HANA2 database on Cloud Foundry and noticed that there is no validation for .hdtable, .hdbview, .hdbprocedure, (which are the specific to SAP HANA2 on Cloud) I would find it interesting to include them here. What do you think?

Regards,

SQL key word not detected maybe due to encoding issue.

when I am opening a sql file that saved from SQL Server Management Studio (SSRS), and saved again using Atom. Here is some problems.

  • The SQL keyword is not colored from atom
  • When opening the sql file from other editor, eg. notepad, there is extra space added between each characters.

Will you help to suggest what is the right way to open it? such as the encoding, line end breaks... etc.
test sql

No scopes on punctuation

Periods, commas, brackets and semicolons are all source.sql

SELECT d.name AS department, max(salary);

Lack of validation for missing DELIMITER in triggers

MySQL rejects statements within TRIGGER declarations, which typically require semicolons, unless an alternative DELIMITER is defined prior to the trigger declaration.

It would be really helpful to highlight TRIGGER declarations in SQL code that are missing custom DELIMITERs, so that the user catches this mistake in the editor, as opposed to later at runtime. As a bonus, it would also be helpful to point out when SQL code neglects to explicitly reset DELIMITER ; following each trigger declaration.

PKB and PKS are SQL too

Additional Information

Hello guys!

I work with ORACLE database and noticed that there is no validation for PKB and PKS (which are the packages specific to ORACLE) they are PL / SQL and I would find it interesting to include them here in this gadget. What do you think?

Regards,

Felipe de Almeida

Create Snippets

Prerequisites

Description

It would be awesome if this package added snippets in the same way that language-javascript did.

language-sql wrongly interprets backslash as escaping char for varchars.

Prerequisites

Description

language-sql wrongly interprets backslash as escaping char for varchars.

Steps to Reproduce

  1. Add content:
begin
  dbms_output.put_line('First line');
  
  dbms_output.put_line('\');
  
  dbms_output.put_line('Second line');
end;
  1. Change syntax to SQL

Expected behavior:

Line dbms_output.put_line('Second line'); should be formatted exactly as dbms_output.put_line('First line');

Actual behavior:

language-sql

Reproduces how often:

100%

Versions

Atom : 1.16.0
Electron: 1.3.13
Chrome : 52.0.2743.82
Node : 6.5.0
Windows: 10
language-sql: 0.25.4

CHANGE keyword not highlighted

Prerequisites

Description

The legacy MySQL 5.7- CHANGE keyword in ALTER TABLE... statements is not being highlighted.

Steps to Reproduce

  1. Write a MySQL 5.7 compatible query to rename a column with ALTER TABLE... CHANGE...

Expected behavior:

CHANGE is highlighted as a keyword.

Actual behavior:

CHANGE is treated as a user field.

Reproduces how often:

Always

Versions

$ apm --version
apm  2.2.4
npm  6.2.0
node 8.9.3 x64
atom 1.39.0
python 2.7.15
git 2.18.0

Create additional grammars for catering for the various variants

It appears that there is enough differentiation between SQL variants such as T-SQL from Microsoft and the MySQL stuff for instance.

As there is functionality for multiple grammars e.g. how c and c++ are catered for by one package.

Would it make sense to add new grammars to this package then.
There are two forks currently for each of the languages:
MySQL: https://atom.io/packages/language-sql-mysql by @typester
T-SQL: https://atom.io/packages/language-tsql by @mattiascibien

Perhaps it would be helpful so that we avoid issues like #28 and we could invite the original developers of this package to make those changes?

slowness when functions reside within SQL DDL file

I noticed a pattern of behavior with Atom's performance while I work on SQL in the editor where Atom lags in performance the moment that SQL functions are defined somewhere in my code. The performance difference is dramatic. I have no SQL related packages installed -- only the standard SQL package bundled with Atom exists.

Add ability to highlight SQL within a template literal

Description

SQL code within template literals appears without SQL syntax highlighting.

screen shot 2017-04-15 at 11 00 12

It would be nice to be able to utilize language-sql syntax highlighting for arbitrary text string within a code base.

A SQL string can be differentiated from other text by using a convention comment, e.g.

-- syntax-sql
SELECT
  id
FROM
  event
WHERE
  id IN ? AND
  -- Do not update seat information for event that has past or is due
  -- to start in less than 2 minutes.
  starts_at > + INTERVAL '2 MINUTE' AND
  -- Used to throttle seat request to at most once a minute.
  (
    seat_asked_at IS NULL OR
    seat_asked_at < NOW() - INTERVAL '1 MINUTE'
  )
FOR UPDATE

where syntax-sql triggers the syntax highlighting.

Numbers at end of strings aren't highlighted as part of the string

I updated to 1.21 and noticed this started to happen. The digits at the end of the string should be the same color as the string.

screen shot 2015-11-18 at 10 57 17 am

language-sql
├── 0.19.0
├── https://github.com/atom/language-sql
├── SQL language support in Atom
├── 120180 downloads
└── 29 stars

Highlight JSON type

Now that SQL implementations offer native JSON types, would be good to highlight this keyword as well.

When used within a PHP string, interpolated PHP variables remain unstyled

Prerequisites

Description

Out of the box, VSCode seems to not encounter this particular issue with SQL highlighting within a PHP string. The highlighting seems to interpret the PHP variable as a string, when it probably should fallback to the language of the file / outer scope and check what sort of class it should have - in this particular case, it should be interpreted as a PHP variable.

Also, I might create another issue for the following, but not sure how easy it is to check for this problem:

  • When using SQL inside a PHP string, it isn't styling joined strings (e.g. concat via .) and
  • When starting the string with a lowercase select, this does not trigger SQL highlighting. I could override the styles and transform them to lowercase, but this might actually be a project's styling convention, to not have the code be screaming at you.

Steps to Reproduce

  1. Create new file
  2. Paste in the following:
<?php
  $editors = '"'.implode('","', ['vim', 'atom', 'vscode']).'"';
  $results = database::select_one_column(
      "SELECT user.id
         FROM user
        WHERE user.healthy = true
          AND user.editor IN ($editors)"
  );

Expected behavior:

$editors should be highlighted/styled like a PHP variable

Screenshot from VSCode

image

Actual behavior:

$editors is styled like any other plain PHP string.

Screenshot from Atom

image

Reproduces how often:

100% of the time

Versions

Atom : 1.58.0
Electron: 9.4.4
Chrome : 83.0.4103.122
Node : 12.14.1

apm 2.6.2
npm 6.14.13
node 12.14.1 x64
atom 1.58.0
python
git 2.25.1

Ubuntu 20

Additional Information

It applies the styles of syntax--source syntax--sql syntax--embedded syntax--php and takes the form of a text element.

image

It is also worth noting that disabling this package, will correctly display PHP string interpolation.

Indenting undone when I enter () next to a data type

I'm writing out some create table statements, and whenever I type the parenthesis after VARCHAR for example, the indent I have is undone.

So

   VARCHAR(255)

becomes

VARCHAR(255)

I can re-intent it again, but it gets annoying to do that.

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.