railk / t3s Goto Github PK
View Code? Open in Web Editor NEWTypeScript plugin for Sublime Text using TSS
License: MIT License
TypeScript plugin for Sublime Text using TSS
License: MIT License
Setting this to true does pass the --noImplicitAny flag to tsc, but T3S doesn't seem to report the errors anywhere and compilation silently succeeds. If tsc is run manually on the same file it does report the implicit any errors but treats them more like warnings and generates the output files anyway.
hi,
i'm using a grunt build file which watches for changes and compiles everything for me, i was wondering if there's a simple way to prevent T3S from running a build.
if you run Ctrl+B it compiles all the typescript files down to javascript.
i know because it adds all those *.js files to me git working tree, plus i can see it in the console on sublime.
i sometimes accidentally hit the key combination and it runs. at the moment would prefer it not to run.
thanks for the great work
regards
Using The latest plugin with SublimeText3.
I have two typescript files A and B.
I export a function from B.
I use this function in A.
I change the function signature in B.
I have a highlight error in A.
I fix the usage based on the signature in A.
I still see the error highlight in A (even if now wrong as the project compiles).
Completion in A shows the new signature.
Looks like the error highlighting use the out of date definition of B.
Even if I try to reload the project (F5), it does not fix the problem.
The workaround is to close / reopen SublimeText
The error highlight should stay consistent.
Build parameters should be overriden in the project or .sublimets file, since some settings might change in different projects.
For example, a nodejs project uses commonjs format, but a front end app will use the amd module format.
I am using Grunt with grunt-typescript to invoke the tsc compiler on my *.ts files. I am using T3S for syntax highlighting within Sublime, and I found that when using the --out
tsc parameter (in the tsc invoked by grunt) there is no way to tell that to T3S.
T3S will complain about not finding any types that are not in the same file. Note that when using the --out
flag, all *.ts files that you pass are compiled into a single .js file. There is no import/export within my code, as the tsc compiler will automatically resolve all types that are in the list of *.ts files.
As a workaround I put the ///<reference path="..." />
into the source code, so that T3S stil works. But for the compile step to work, I wouldn't need these reference tags.
Would it be possible to add an option to include the sublime-supplied symbol completions in addition to the type-safe completions? There is a case for both lists, it's a shame to loose the other side by installing this plugin.
HI,
I have this file for example:
var t = "ร";
And when I save it I have this error:
File "...\Sublime Text 3\Packages\T3S\lib\Utils.py", line 112, in get_data
if os.name == 'nt': f = open(file,'r').read()
File "X/encodings/cp1252.py", line 23, in decode
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 10: character maps to <undefined>
I fixe it by commenting line 112 concerning windows in Utils.py line:
#if os.name == 'nt': f = open(file,'r').read()
#else:
f = codecs.open(file,'r','utf-8').read()
Do you think it is necessary to check OS when reading a file, because codecs.open function seems to work on my Windows 7 ?
When I press F4 - to use the "go to definition" functionality, sublime doesn't open a new tab with the file containing the definition - instead, something weird happens, as if the other file is somehow opened 'within' the currently open file (the scrollbar seems to scroll both of them).
I am using T3S at commit 4240d64... and Sublime3.
Hello I'm on windows and istalled sublime text then node.js, then T3S into the Packages directory of Sublime Text 3. I'm seeing the new synthax option and also the settings of the plugin, but no auto completion is available. I'm seeing errors checking though. Also how to build a .ts file into .js file?
Hi there,
The plugin works great. I think it needs to be in package control. Do you need help putting it in there?
Not sure if dev is the right branch or not. Should I be on master?
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 303, in on_activated
callback.on_activated(v)
File "/Users/seanhess/Library/Application Support/Sublime Text 3/Packages/T3S/lib/Listener.py", line 79, in on_activated
self.init_view(view)
File "/Users/seanhess/Library/Application Support/Sublime Text 3/Packages/T3S/lib/Listener.py", line 91, in init_view
init(view)
File "/Users/seanhess/Library/Application Support/Sublime Text 3/Packages/T3S/lib/Listener.py", line 43, in init
TSS.init(root)
File "/Users/seanhess/Library/Application Support/Sublime Text 3/Packages/T3S/lib/Tss.py", line 27, in init
PROCESSES.add(root,self.notify)
File "/Users/seanhess/Library/Application Support/Sublime Text 3/Packages/T3S/lib/system/Processes.py", line 112, in add
print('typescript initializing '+root)
TypeError: Can't convert 'NoneType' object to str implicitly
Hi, would be possible to provide autocomplete as you type?
If it would be too slow, how about show basic sublime autocomplete by default and bind T3S autocomplete to key shortcut?
When performing any action with this plugin, I'm seeing the following error in the console:
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 543, in run_
return self.run(edit, **args)
File "/Users/kkaefer/Library/Application Support/Sublime Text 3/Packages/T3S/Typescript.py", line 505, in run
types = TSS.type(self.view,line,col)
File "/Users/kkaefer/Library/Application Support/Sublime Text 3/Packages/T3S/Typescript.py", line 172, in type
process.stdin.write(bytes('type {0} {1} {2}\n'.format(str(line+1),str(col+1),view.file_name().replace('\\','/')),'UTF-8'))
AttributeError: 'str' object has no attribute 'stdin'
I'm using Sublime Text 3 build 3047 on Mavericks.
todo
Every external module import is highlighted with the error "Module cannot be aliased to a non-module type." For example, given the following project structure:
src/
client.ts
game/
Game.ts
project.sublime-project
Where project.sublime-project is
{
"folders":
[
{
"follow_symlinks": true,
"path": "."
}
],
"settings":
{
"typescript":
[
"src/client.ts"
]
}
}
src/client.ts is
import game = require("game/Game");
game();
And src/game/Game.ts is
export = game;
function game(): void {
console.log("Hello, world!");
}
Line 1 of src/client.ts is marked with the error and no completions or type checking are available for definitions in src/game/Game.ts
This project compiles fine and behaves as expected with tsc.
In an AngularJS project, many of the completions start with "$". For example I have scope
, which has a method scope.$apply()
If I type scope.
then hit enter while scope.$apply()
is highlighted, I get the following
scope.();
I am pointing my typescript file to an external definition. On the line where I am requiring this definition:
///<reference path="../node-definitions/node.d.ts" /> import Http = require('http');
I see this error in Sublime TS2072: Module cannot be aliased to a non-module type.
Compiling the project with grunt-typescript works just fine.
I have tried opening the definition and reloading the project (F5) to no avail.
I've created a dev branch so that we can work on this one, for modifications and pull request before merging to the master branch. It' ll be safer and like it's my first open source project, if i make a mistake with a merging it will still be ok :). Thank you.
Hey there. I've been exploring TypeScript over the weekend, and one of my first steps after the getting started was yak shaving. T3S looks very solid so far and I'm having a generally good time, with the exception of one issue. I can't seem to get any of the publicly available *.d.ts files to provide type information within my project files. Here's my setup:
project/
|-- typings/
| |-- node/
| | |-- node.d.ts
| |-- underscore/
| |-- underscore.d.ts
|-- index.ts
The type definition files were pulled using the 5.x version of tsd, with the Definitely Typed project. I've verified they match the files on GH. Within index.ts:
/// <reference path="typings/node/node.d.ts" />
/// <reference path="typings/underscore/underscore.d.ts" />
import _ = require('underscore');
At this point, when using _
, the type is reported as _
, but no completions are available. Any idea what's up?
If I can provide any debugging assistance, please let me know.
I have some code like the following:
export interface IGenericInterface<T> {
createGenericThingArrays(): Array<Array<T>>;
}
export class GenericClass<T> implements IGenericInterface<T> {
public createGenericThingArrays(): Array<Array<T>> {
return null;
}
}
But 'GenericClass' is highlighted with the error message 'TS2137: Class GenericClass declares interface IGenericInterface but does not implement it.
The code compiles fine with tsc however.
Perhaps this is an issue with TypeScript tools, if so I will report it there.
Many thanks,
First of all, thanks for doing this - your plugin is an excellent help when working with Typescript.
One problem, though ; Sublime 3 (which I am using) is spawning a different node.js instance for each .ts file I am opening. Since I am working on very big TypeScript projects, this ends up eating all my memory very quickly, as I navigate from file to file (and therefore sublime opens additional node instances).
Have I done something wrong during the plugin installation process, or is this an attribute of the current implementation? That is, is there a way to "feed" all the .ts files in a single node instance of tss, and have Sublime "speak" to that alone?
Thanks in advance.
Build failing with the following error:
C:\Users\********\AppData\Roaming\Sublime Text 2 \Packages\T3S\Typescript.build.js:65
pre_processing_commands = config['pre_processing_commands'],
^
TypeError: Cannot read property 'pre_processing_commands' of undefined
at build_commands (C:\Users\********\AppData\Roaming\Sublime Text 2\Packages\T3S\Typescript.build.js:65:35)
at Object.<anonymous> (C:\Users\********\AppData\Roaming\Sublime Text 2\Packages\T3S\Typescript.build.js:82:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
Windows 8
SublimeText 2
Last TypeScript
node v0.10.15
currently working on it
I may be doing something wrong but when I create a project containing only
https://github.com/borisyankov/DefinitelyTyped/blob/master/node/node.d.ts
I get lots of errors.
e.g. duplicate overloaded signature for:
declare function setImmediate(callback: () => void ): any;
declare function clearImmediate(immediateId: any): void;
However setImmediate is declared only once.
If I try ctrl+shift+e
it says no errors...!?
Using ST2 on Windows.
Having a proper build would be nice. It should be configurable (is this possible?) so the used module kind (AMD; CommonJS), out-file and other parameters can be changed, when needed.
Hi,
Just wondering why the snippets have the braces on the following line, when i have been looking at the code examples on http://www.typescriptlang.org/Tutorial/ they seem to have the braces on the same line.
If you would like to make this change I'm happy to submit a pull request with the changes.
Great job so far by the way!!!
Using the plugin on a medium-sized project which needed to be updated to Typescript 0.9 was difficult because there were many errors spread across files, but I had no way of seeing how many files still had errors.
The best: would be if there was a way to mark a file/folder in the sidebar with a flag showing errors, but I don't think this is possible.
Alternatively: we should make some kind of panel you can open up, or a new window like find in project, that shows all the errors in the project and lets you jump to the files.
What do you think?
While porting my legacy project to the latest typescript, I find frequently that I will change something, and it will continue to highlight an error even though it doesn't exist. This persists if I switch file, edit, and save the file.
In this example, note how the status says "express/node.d.ts" while the line has now been correctly changed to: "node/node.d.ts".
I don't notice anything in the sublime log.
todo
If build_parameters is included in the user or project settings files and doesn't have both pre_processing_commands and post_processing_commands then builds will silently fail. This is unintuitive since those settings are supposed to override the defaults (which should be an empty list in this case). At the very least it would be nice to get an error message in the console.
Looks like a simple check in the build.js file before trying to loop over these arrays should fix the problem.
Similiar to SublimeLinter, can gutter marks be disabled and, instead, in place annotations be used?
Things work great when I create a new file, add a reference file, and write some typescript. However, when I change the reference to point to a different file, or I change the definitions inside the referenced file, the plugin still seems to use the old version. The only way I can get it to take the new reference or changes to the referenced file into account is to close and restart sublime text.
Sometimes it is hard to work because I have really big memory usage.
I have two node processes for each typescript tab. Each process near 150 mb.
So, five tabs: 5_2_150 = 1,5 gb. Too much!
Also sometimes node processes are not killed after tab closing.
Hi,
when I do :
With Git:
Clone the repository in your Sublime Text Packages directory.
Checkout ST2 branch using git checkout st2.
I get :
daslicht:t3s daslicht$ git checkout st2
error: pathspec 'st2' did not match any file(s) known to git.
?
Hi,
first of all great plugin!!!!
I'd very much love an option to build on save. Is that possible?
Thanks!
Sometimes when autocomplete takes place (after typing '.'), the result has a ';' at the end. This can be annoying if you're modifying a parameter to a function you're calling.
For example, after autocomplete (for the toLowerCase), this can happen
someFunction('someString'.toLowerCase(););
I'm using the dev branch.
Thanks for any help. I may look at submitting a pull request to fix this.
So, raph-amiard has offered to let someone take control of his repository. I've asked him to transfer ownership to me, so then we can do what we want with it.
It may make sense to simply replace his repository with this one, so it would be: Railk/sublime-typescript, and the package control sublime-typescript package would point to this code.
The advantage would be less fragmentation in the sublime community. I'd like for there to be a clear typescript choice in package control and from google.
What do you think? Do you think it would be better to keep them separate?
Currently the dev
branch is 49 commits behind master branch (and some commits ahead, which is expected).
Wouldn't it be easier if the dev
branch could be at least 0 commits behind master?
In my local version of the plugin I added an osx_node_path
entry to .sublime-settings
(I'm an OSX user that installs node via NVM).
Adding some official support for that would be nice. I'm happy to submit a patch, but I'm not familiar with Sublime's internals enough to know how to use that same setting in the build system -- which would important.
Is it possible to enable only searching on the name of the method / property when auto completing? Currently the type is included within the search criteria.
Many thanks.
In visual studio 2013, we don't have to reference any files anymore, because vs2013 will find any .ts or .d.ts file and automatically reference it.
I opened a project i'm using that looks like this:
I do have all my types definition but it doesn't find them automatically.
WHat can we do to fix that?
Is there a way to globally add references?
Hi!
Thanks for the plugin.
I was a little confused with the build system documentation you have, perhaps you can help me.
Here's the project in which we'd like to use your plugin: https://github.com/eonarheim/Excalibur
We added a typescript
property to the settings
property in the Sublime project file. According to your docs, that should make the build system use a root file to compile.
"settings":
{
"tab_size": 3,
"typescript": [
"ts/Core.ts"
]
}
However, when I hit Ctrl-Shift-B (Build), the console output is:
T3S building ... tsc "D:\Development\Contrib\Excalibur\GameTS.sublime-project"
executing command : tsc "D:\Development\Contrib\Excalibur\GameTS.sublime-project"
error TS5007: Cannot resolve referenced file: 'D:\Development\Contrib\Excalibur\GameTS.sublime-project'.
To me, that looks like the build script is just passing in the current filename... not getting the root files.
Could you clone the repo and try to get the project to build? Ultimately, we want to just compile Core.ts
and output to js
folder like we do with the bat file right now.
I'm sure I'm doing something wrong but I created a file server.ts and created a file .sublimets with
{
"root":"server.ts"
}
But when I open server.ts, there's no indication of any kind of initialization and autocomplete doesn't work. I've tried it with this code:
class Message {
txt: string;
constructor() {
}
}
var msg = new Message();
msg.
nothing shows up. Furthermore, when I try F3, it says that the plugin is still initializing. Sorry for the poor indentation. I have no idea how to do it properly here.
Hi,
is it possible to create a splitview to see the JS right after running the TS compiler?
This feature exists in the WebEssentials 2012 for Visual Studio 2012 (Not anymore in WebEssentials 2013 but built in Visual Studio 2013). This would be great.
Regards
Chris
Took the plug-in for a quick spin, and everything seems to work nicely - it correctly reports TypeScript errors and auto-completes properties.
However, it does not auto-complete or provide hints about method arguments - for example, if I type:
document.createElement('div').setAttribute(
... and press CTRL+space, it auto-completes with every global variable/class in the system.
I am not currently an ST2 user, and I couldn't find anything on this subject in the ST2 docs, perhaps providing hints about arguments (types, documentation) is just not a feature ST2 has? (if so, do you know if ST3 will have this feature?)
It will be cool if tooltips with JSDoc comments are shown if JSDoc provided.
I understand the idea behind this, but the fact that you can't close it makes it more annoying than anything. Sometimes I just want to open a standalone .ts file to copy stuff from it or something and this panel gets in the way and prevents me from doing anything. Could the panel be made optional or something?
Investigate basic refactoring with tss references command
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.