Giter VIP home page Giter VIP logo

cmp-dbee's Introduction

cmp-dbee

ci

Autocompletion plugin for nvim-dbee database client.

Still very much a WIP plugin => expect some breaking changes.

Feel free to open any issues or PRs as you seem fit!

Showcase

cmp_dbee.mp4

Usage

cmp-dbee is using a little bit of regex but mostly Treesitter to generate suggestions.

Suggestions

TL;DR

  • schemas
  • leaf of schemas (tables, views, functions, etc)
  • aliases
  • CTEs
  • columns: name and dtype (by referencing aliases)

By default, schema + model suggestion is generated whenever a user hits "space". At this point, the syntax for the SQL query isn't complete and the plugin therefore uses a little bit of regex to "find/match" the selected schema.

Ones the schemas has been found, the plugin suggests all the "leafs" for the schema.

CTEs and aliases are suggested based on the cursor position. I.e. if you've two complete (complete = ended with ';') queries in the buffer. Then, only the aliases and ctes which the current cursor are nearest will be suggested.

Column suggestion is provided by being explicit. I.e. you'd have to refer the alias of a table if you want column completion. This is to reduce ambiguity when there are other suggestions that compete. Column completion provide you with the current name and the datatype of the column. As of now, only table leafs provides columns. This might change in the future.

Installation

  • Using lazy:
  {
    "hrsh7th/nvim-cmp",
    dependencies = {
      {
        "MattiasMTS/cmp-dbee",
        dependencies = {
          {"kndndrj/nvim-dbee"}
        },
        ft = "sql", -- optional but good to have
        opts = {}, -- needed
      },
    },
    opts = {
      sources = {
        { "cmp-dbee" },
      },
    },
  }

cmp-dbee's People

Contributors

mattiasmts avatar rstcruzo avatar kndndrj avatar kade5 avatar

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.