forked from TypeScriptToLua/TypeScriptToLua.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathe2ceeaf0.7a074cfa.js
More file actions
1 lines (1 loc) · 6 KB
/
Copy pathe2ceeaf0.7a074cfa.js
File metadata and controls
1 lines (1 loc) · 6 KB
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[20],{175:function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return m}));var n=r(0),o=r.n(n);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=o.a.createContext({}),u=function(e){var t=o.a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},l=function(e){var t=u(e.components);return o.a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},b=o.a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,i=e.originalType,a=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),l=u(r),b=n,m=l["".concat(a,".").concat(b)]||l[b]||d[b]||i;return r?o.a.createElement(m,c(c({ref:t},s),{},{components:r})):o.a.createElement(m,c({ref:t},s))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=r.length,a=new Array(i);a[0]=b;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:n,a[1]=c;for(var s=2;s<i;s++)a[s]=r[s];return o.a.createElement.apply(null,a)}return o.a.createElement.apply(null,r)}b.displayName="MDXCreateElement"},565:function(e,t,r){"use strict";r.r(t),t.default=r.p+"assets/images/editor-support-diagnostics-1aa5169b8f0db293dc11667c411f3a5d.png"},78:function(e,t,r){"use strict";r.r(t),r.d(t,"frontMatter",(function(){return i})),r.d(t,"metadata",(function(){return a})),r.d(t,"rightToc",(function(){return c})),r.d(t,"default",(function(){return s}));var n=r(2),o=(r(0),r(175));const i={title:"Editor Support"},a={unversionedId:"editor-support",id:"editor-support",isDocsHomePage:!1,title:"Editor Support",description:"To have basic support for TypeScriptToLua it is enough to configure your editor for TypeScript support.",source:"@site/docs/editor-support.md",slug:"/editor-support",permalink:"/docs/editor-support",editUrl:"https://github.com/TypeScriptToLua/TypeScriptToLua.github.io/edit/source/docs/editor-support.md",version:"current",sidebar:"docs",previous:{title:"Caveats",permalink:"/docs/caveats"},next:{title:"Writing Declarations",permalink:"/docs/advanced/writing-declarations"}},c=[{value:"Language Service Plugin",id:"language-service-plugin",children:[]},{value:"Build Tasks",id:"build-tasks",children:[{value:"Visual Studio Code",id:"visual-studio-code",children:[]}]}],p={rightToc:c};function s({components:e,...t}){return Object(o.b)("wrapper",Object(n.a)({},p,t,{components:e,mdxType:"MDXLayout"}),Object(o.b)("p",null,"To have basic support for TypeScriptToLua it is enough to ",Object(o.b)("a",Object(n.a)({parentName:"p"},{href:"https://github.com/Microsoft/TypeScript/wiki/TypeScript-Editor-Support"}),"configure your editor for TypeScript support"),"."),Object(o.b)("h2",{id:"language-service-plugin"},"Language Service Plugin"),Object(o.b)("p",null,"Sometimes TypeScriptToLua has to report it's own errors during the compilation. To have the same errors displayed in your editor, you can use a ",Object(o.b)("a",Object(n.a)({parentName:"p"},{href:"https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin"}),"language service plugin"),"."),Object(o.b)("p",null,Object(o.b)("img",{src:r(565).default})),Object(o.b)("p",null,"To use it either get a ",Object(o.b)("a",Object(n.a)({parentName:"p"},{href:"https://marketplace.visualstudio.com/items?itemName=ark120202.vscode-typescript-to-lua"}),"Visual Studio Code extension")," or ",Object(o.b)("a",Object(n.a)({parentName:"p"},{href:"https://github.com/TypeScriptToLua/typescript-tstl-plugin#installation"}),"add it to your project"),"."),Object(o.b)("h2",{id:"build-tasks"},"Build Tasks"),Object(o.b)("p",null,"Most of advanced code editors can build your project with ",Object(o.b)("a",Object(n.a)({parentName:"p"},{href:"https://docs.npmjs.com/misc/scripts"}),"npm scripts"),"."),Object(o.b)("pre",null,Object(o.b)("code",Object(n.a)({parentName:"pre"},{className:"language-json",metastring:"title=package.json",title:"package.json"}),'{\n "scripts": {\n "build": "tstl",\n "dev": "tstl --watch"\n }\n}\n')),Object(o.b)("h3",{id:"visual-studio-code"},"Visual Studio Code"),Object(o.b)("p",null,"VSCode supports running npm scripts using ",Object(o.b)("a",Object(n.a)({parentName:"p"},{href:"https://code.visualstudio.com/docs/editor/tasks"}),"tasks"),". To define a task, create a ",Object(o.b)("inlineCode",{parentName:"p"},".vscode/tasks.json")," file or press ",Object(o.b)("inlineCode",{parentName:"p"},"F1")," and run ",Object(o.b)("inlineCode",{parentName:"p"},"Tasks: Configure Task")," command. Example configuration:"),Object(o.b)("pre",null,Object(o.b)("code",Object(n.a)({parentName:"pre"},{className:"language-json",metastring:"title=tasks.json",title:"tasks.json"}),'{\n "version": "2.0.0",\n "tasks": [\n {\n "type": "npm",\n "script": "dev",\n "problemMatcher": "$tsc-watch",\n "isBackground": true,\n "presentation": { "reveal": "never" },\n "group": { "kind": "build", "isDefault": true }\n }\n ]\n}\n')))}s.isMDXComponent=!0}}]);