GithubHelp home page GithubHelp logo

ryo7000 / vue-ts-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from herringtondarkholme/vue-ts-plugin

0.0 0.0 0.0 30 KB

Typescript Language Service Plugin for Vue

License: Apache License 2.0

TypeScript 100.00%

vue-ts-plugin's Introduction

TypeScript Language Service Plugin for Vue

WARNING: This plugin is in an alpha state. For a more polished experience, try the VS Code plugin vetur. This plugin, however, works with the Typescript language service. So you can use it with whatever editor you want.

This plugin does three things for Javascript and Typescript source in a .vue file:

  1. It uses vue-template-compiler to parse out the script section of a .vue file.
  2. It wraps a default exported object literal in new Vue(...) in order to propagate the Vue contextual type so that no type annotations are needed.
  3. It uses the Typescript language service to provide completions.

It also resolves import other from "other.vue"; statements in the same manner. It does not support completions in the template tag. It doesn't even support the template or style tags.

Features left to add

  1. Recognise ES5-style module.exports = { ... in addition to ES6 export default { ....
  2. Recognise only lang="javascript", lang="typescript" and no lang attribute. Others should not turn on the language service.

Instructions

  1. $ npm install ts-vue-plugin
  2. Add plugin to tsconfig.
{
  compilerOptions: {
    "allowSyntheticDefaultImports": true,
    "plugins": [{ "name": "ts-vue-plugin" }]
  }
}
  1. Run the Select TypeScript version command in VS Code to use the workspace version of TypeScript. You can find more information about managing typescript versions in the VS Code documentation.

For example, in Emacs, add the line:

(add-to-list 'auto-mode-alist '("\\.vue$" . typescript-mode))

If you're Vim user, you can use tsuquyomi-vue.

Now you have typescript support inside the script tags. HTML and CSS support are non-existent right now.

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.