Git Product home page Git Product logo

typescript-tools's People

Contributors

clausreinke 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  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  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

typescript-tools's Issues

Can you please mark tss as executable?

First of all, excellent work - your typescript tools work fine in my tests so far, thank you very much for the effort you spent building them.

Now, I have added this section in my .vimrc...

let $PATH .= ':' . $HOME . '/.vim/bundle/typescript-tools/bin'
au BufNewFile,BufRead *.ts call SetupTSEnviron()
function! SetupTSEnviron()
    setlocal filetype=typescript
    noremap <buffer> <F8> :set rtp+=$HOME/.vim/bundle/typescript-tools/<CR>:TSSstarthere<CR>
endfunction

This allows me to hit F8 when I have a TypeScript file open, and only then, spawn the relevant "node" instance with your tools on it. This means I don't have to wait for TSS unless I actually want to do auto-completion on the file that is currently open.

This, as you can see, depends on my adding of your tools "bin" folder to the vim-aware PATH env var - which means it depends on your "tss" being executable.

Can you please set it as such? As it is right now, I have "local modifications" in my pathogen mirror of your plugin (i.e. under .vim/bundle/typescript-tools/).

Also, do you see anything wrong with my approach? It seems to work fine, but let me know if this violates some principle you depend on.

Again, thanks for all your hard work building this.

Upgrade to Typescript 1.4

The project still seems to reference Typescript 0.9.1.

Are there any plans to upgrade to Typescript 1.3? (Would be happy to help, but it looks like the TS API has changed quite a bit since 0.9.1, and wasn't clear to me which areas would need changing from looking at the code)

"update" doesn't work as expected

Ok, so I got one more problem. I'm trying to get update to work - unfortunately, without success.

Everything works as expected, but then I do update and get an empty completion list. After I reload the project, everything works fine again.
The code is unchanged, I just update it with the same lines.

Source code:

///<reference path='../external/typescript/bin/lib.d.ts'/>
var s:string = "";
s.

Log (I've shortened entry lists):

C:\dev\TS>node external\typescript-tools.git\bin\tss.js src\competion.ts
"loaded C:/dev/TS/src/competion.ts, TSS listening.."

> completions true 3 3 C:/dev/TS/src/competion.ts
{"maybeInaccurate":false,"isMemberCompletion":true,"entries":[{"name":"toString","type":"() => string","kind":"method","kindModifiers":"declare,public"},{"name":"charAt","type":"(pos: number) => string","kind":"method","kindModifiers":"declare,public"}, <...> ]}

> reload
"reloaded C:/dev/TS/src/competion.ts, TSS listening.."
> completions true 3 3 C:/dev/TS/src/competion.ts
{"maybeInaccurate":false,"isMemberCompletion":true,"entries":[{"name":"toString","type":"() => string","kind":"method","kindModifiers":"declare,public"},{"name":"charAt","type":"(pos: number) => string","kind":"method","kindModifiers":"declare,public"}, <...> ]}

> update 3 C:/dev/TS/src/competion.ts
///<reference path='../external/typescript/bin/lib.d.ts'/>
var s:string = "";
s.
"updated C:/dev/TS/src/competion.ts"

> completions true 3 3 C:/dev/TS/src/competion.ts
{"maybeInaccurate":false,"isMemberCompletion":true,"entries":[]}

> reload
"reloaded C:/dev/TS/src/competion.ts, TSS listening.."

> completions true 3 3 C:/dev/TS/src/competion.ts
{"maybeInaccurate":false,"isMemberCompletion":true,"entries":[{"name":"toString","type":"() => string","kind":"method","kindModifiers":"declare,public"},{"name":"charAt","type":"(pos: number) => string","kind":"method","kindModifiers":"declare,public"}, <...> ]}

TSSstarthere error

I keep getting the following error when I try to run :TSSstarthere.

Starting TSS, loading file.ts...
Error detected while processing function TSSstart:
line   18:
Traceback (most recent call last):
  File "<string>", line 3, in <module>
TypeError: cannot concatenate 'str' and 'list' objects
Error detected while processing function TSSstart..TSSshowErrors:
line   16:
TSS not running - start with :TSSstarthere on main file

It definitely worked the very first time I used it but it seems subsequent commands have failed.

Feature Request: CtrlP integration

File navigation could be a lot smoother when integrated with CtrlP. The coupling may seem odd, but should be worth the trade off. For reference, the omnisharp guys also decided to go down that route.

Use Unix encoding for newlines in bin/tss

TSS as distriubuted via melpa has DOS end-of-line encodings for bin/tss. This makes unix shell look for "node\r" instead of "node".

This seems to be a git feature that it checks out bin/tss in text mode with CRLF on Windows and LF on Unix so that if you create melpa package on Windows you get CRLF in text files. Usually it does not matter but causes bash to stumble.
Exact message:

~/node_modules/typescript-tools/bin:$ ./tss
env: node\r: No such file or directory

Please make sure that LF is used for unix scripts always.

update get tss confused about linemaps

(copied from #4, reported by @Railk; as it seems to be a different issue)

Hello

I'm currently making a small plugin (for me) for SublimeText 3 using TSS testing_v09 branch (really great work !).

For ref i'm using node 0.10.15 on a windows 64bit machine

I've got completions/showErrors/reload command working as it should, but i cannot make the update command work in SublimeText.

So i tried in the windows Shell and i've got the same errors/problems

The content of the file (test2.ts) :

var x = {a:1,b:2};
var y = {c:1,d:2};
x.a;
y.d;

I then update in the shell by copy&paste and by typing line by line to:

var x = {a:1,b:2};
var y = {c:1,d:2};
var z = {e:1,f:2};
x.a;
y.d;

The shell log :

Bash@ /d/X_MEDIAS_X/__DOWNLOAD/SublimeText3/Data/Packages/Typescript_2/test $ tss test2.ts
"loaded D:/X_MEDIAS_X/__DOWNLOAD/SublimeText3/Data/Packages/Typescript_2/test/test2.ts, TSS listening.."

> completions true 4 3 D:/X_MEDIAS_X/__DOWNLOAD/SublimeText3/Data/Packages/Typescript_2/test/test2.ts
{"maybeInaccurate":false,"isMemberCompletion":true,"entries":[{"name":"c","kind":"property","kindModifiers":"public","type":"number","fullSymbolName":"c","docComment":""},{"name":"d","kind":"property","kindModifiers":"public","type":"number","fullSymbolName":"d","docComment":""}]}

> update 5 D:/X_MEDIAS_X/__DOWNLOAD/SublimeText3/Data/Packages/Typescript_2/test/test2.ts
var x = {a:1,b:2};
var y = {c:1,d:2};
var z = {e:1,f:2};
x.a;
y.d;
"updated D:/X_MEDIAS_X/__DOWNLOAD/SublimeText3/Data/Packages/Typescript_2/test/test2.ts"

> completions true 4 3 D:/X_MEDIAS_X/__DOWNLOAD/SublimeText3/Data/Packages/Typescript_2/test/test2.ts
"TSS command processing error: Error: error TS5028: Argument out of range: position."

> update 5 D:/X_MEDIAS_X/__DOWNLOAD/SublimeText3/Data/Packages/Typescript_2/test/test2.ts
> var x = {a:1,b:2};
var y = {c:1,d:2};
> var z = {e:1,f:2};
x.a;
y.d;
"updated D:/X_MEDIAS_X/__DOWNLOAD/SublimeText3/Data/Packages/Typescript_2/test/test2.ts"

> completions true 4 3 D:/X_MEDIAS_X/__DOWNLOAD/SublimeText3/Data/Packages/Typescript_2/test/test2.ts
"TSS command processing error: Error: error TS5028: Argument out of range: position."

> dump D:/X_MEDIAS_X/__DOWNLOAD/SublimeText3/Data/Packages/Typescript_2/test/test2.txt D:/X_MEDIAS_X/__DOWNLOAD/SublimeText3/Data/Packages/Typescript_2/test/test2.ts
"dumped D:/X_MEDIAS_X/__DOWNLOAD/SublimeText3/Data/Packages/Typescript_2/test/test2.ts to D:/X_MEDIAS_X/__DOWNLOAD/SublimeText3/Data/Packages/Typescript_2/test/test2.txt"

I made a dump like you suggested to Zlumer and the result of the dump file is what it should be:

var x = {a:1,b:2};
var y = {c:1,d:2};
var z = {e:1,f:2};
x.a;
y.d;

If i reload everything works fine.

So I'm not sure what i'm making wrong or is it still a problem with readline ?

add configuration support

So far, we've got a fixed configuration built-in (mostly the default config, with target set to ES5). There is also a hack to support loading different lib.d.ts files. In the future, we should try to support configuration in more standard ways, perhaps via startup flags, more likely via the new .tsconfig files.
Related issues: #41 #43.

TSS reporting reference error that does not happen on compile

When the reference directive is not properly closed

///<reference path="anyfile.d.ts">

TSS returns the error error TS1084: Invalid 'reference' directive syntax., but TSC compiles normally.

Test case:
File test.ts:

///<reference path="anyfile.d.ts">

Input:

showErrors

Output:

[{"file":".../test.ts","start":{"line":1,"character":1},"end":{"line":1,"character":34},"text":"error TS1084: Invalid 'reference' directive syntax.","phase":"Resolution","category":"Error"}]

Multiple following updates will place tss in a broken state

Calling update repeatedly will cause the program to stop returning useful information.

Test case:

update 1 PREFIX/new_test.ts
var i = 20;
update 1 PREFIX/new_test.ts
var i = 10;
definition 1 5 PREFIX/new_test.ts

produces

"loaded PREFIX/new_test.ts, TSS listening.."
"updated PREFIX/new_test.ts"
"updated PREFIX/new_test.ts"
"TSS command processing error: TypeError: Cannot call method 'span' of null"
"TSS closing"

Can't run tss commands on Ubuntu 12.10

I've installed typescript-tools using sudo npm install -g typescript-tools.
Then I've tried the tss tests/test.ts example commands, like type 4 2 /home/fjsj/workspace/typescript-tools/tests/test.ts, but all commands return "TSS command processing error: TypeError: Cannot read property 'lineMap' of null".

Any ideas how to solve this?

subprocess.Popen in the vim plugin should be given a quoted string, not a list

from the docs:

On Unix with shell=True, the shell defaults to /bin/sh. If args is a string, the string specifies the command to execute through the shell. This means that the string must be formatted exactly as it would be when typed at the shell prompt. This includes, for example, quoting or backslash escaping filenames with spaces in them. If args is a sequence, the first item specifies the command string, and any additional items will be treated as additional arguments to the shell itself. That is to say, Popen does the equivalent of:
Popen(['/bin/sh', '-c', args[0], args[1], ...])

this line caused :TSSstarthere to fail with a vexing error like "TSS not started" for me (Python 2.7.2, Mac OS X 10.8). I added some debugging output and found that, every time :TSSstart was called, process.argv in the tss.js script was set to [ 'node', '/usr/local/bin/tss' ] because the additional arguments given to Popen were passed to the shell and not to the tss process.

References command

I'm looking into references command to implement some basic refactoring :

When i do a references command on the main.ts file on the start method, i have those in main.ts and second.ts.

But when i do that on the actual method declaration in second.ts first time i have only the second.ts one and on the second call this time i have the main.ts, i didn't have first.

Bash@ /c/Program Files/SublimeText3/Data/Packages/T3S/__work__/tests/references $ tss main.ts
"loaded c:/Program Files/SublimeText3/Data/Packages/T3S/__work__/tests/references/main.ts, TSS listening.."

> references 7 10 c:/Program Files/SublimeText3/Data/Packages/T3S/__work__/tests/references/second.ts

[
    {
        "ref":{
            "fileName":"c:/Program Files/SublimeText3/Data/Packages/T3S/__work__/tests/references/second.ts",
            "minChar":55,
            "limChar":60,
            "isWriteAccess":true
        },
        "file":"c:/Program Files/SublimeText3/Data/Packages/T3S/__work__/tests/references/second.ts",
        "min":{"line":7,"character":9},
        "lim":{"line":7,"character":14}
    }
]

> references 7 10 c:/Program Files/SublimeText3/Data/Packages/T3S/__work__/tests/references/second.ts

[
    {
        "ref":{
            "fileName":"c:/Program Files/SublimeText3/Data/Packages/T3S/__work__/tests/references/second.ts",
            "minChar":55,
            "limChar":60,
            "isWriteAccess":true
        },
        "file":"c:/Program Files/SublimeText3/Data/Packages/T3S/__work__/tests/references/second.ts",
        "min":{"line":7,"character":9},
        "lim":{"line":7,"character":14}
    },
    {
        "ref":{
            "fileName":"c:/ProgramFiles/SublimeText3/Data/Packages/T3S/__work__/tests/references/main.ts",
            "minChar":77,
            "limChar":82,
            "isWriteAccess":false
        },
        "file":"c:/Program Files/SublimeText3/Data/Packages/T3S/__work__/tests/references/main.ts",
        "min":{"line":4,"character":8},
        "lim":{"line":4,"character":13}
    }
]

main.ts

import Second = require("second");

var second = new Second.Test()
second.start();
second.stop();

second.ts

export class Test{

    constructor(){

    }

    public start(){
        return this;
    }

    public stop(){
        return this;
    }
}

I don't know what's causing that.

Error if non-existing files are listed in tsconfig.json

I get this error, if the user has listed non-existing files in tsconfig.json.
Maybe you could catch those files.

ArcticTypescript: error   : typescript-tools error: 
 C:\Users\Harris\AppData\Roaming\Sublime Text 3\Packages\ArcticTypescript\bin\tss.js:190

            seenNoDefaultLib = seenNoDefaultLib || source.hasNoDefaultLib;

                                                         ^

TypeError: Cannot read property 'hasNoDefaultLib' of undefined

    at C:\Users\Harris\AppData\Roaming\Sublime Text 3\Packages\ArcticTypescript\bin\tss.js:190:58

    at Array.forEach (native)

    at TSS.setup (C:\Users\Harris\AppData\Roaming\Sublime Text 3\Packages\ArcticTypescript\bin\tss.js:188:24)

    at Object.<anonymous> (C:\Users\Harris\AppData\Roaming\Sublime Text 3\Packages\ArcticTypescript\bin\tss.js:600:5)

    at Module._compile (module.js:460:26)

    at Object.Module._extensions..js (module.js:478:10)

    at Module.load (module.js:355:32)

    at Function.Module._load (module.js:310:12)

    at Function.Module.runMain (module.js:501:10)

    at startup (node.js:129:16)

omni-completion with no arglead may cause an error

When I locate the cursor at an empty line of a ts file and invoke omni-completion, I get an error: type isn't in the dictionary.

The problem can be solved by changing line 244 of typescript_tss.vim to:

call add(result, {'word': entry['name'], 'menu': get(entry, 'type', ''), 'info': get(entry, 'docComment', '') })

BTW it would be nice if :TSSstarthere were called automatically if necessary, i.e. e.g. when invoking omni-completion without having calles :TSSstarthere before. I think it would also be a good idea to move all functions (and variables) to an autoload file (see :h autoload). Commands should probably have a -buffer flag (see :h :command-buffer) since they are not valid in non-typescript buffers. Since the ftplugin file is loaded everytime a typescript file is opened, the ftplugin file should be as small as possible and it shouldn't redefine already defined functions/commands/variables.

Can't get completions to work

Hello

I tried using TSS a couple times and can't get completion to work.
All the type or definition searches are correct, but I get an empty array for completions.
Source file content:

var s:string = ""; s.

(it doesn't work with line breaks too, I removed them only for easier testing)

Look at the output below:

C:\dev\TS>node external\typescript-tools.git\bin\tss.js src\competion.ts
"loaded C:/dev/TS/src/competion.ts, TSS listening.."
>
"TSS command syntax error: "
type 1 22 C:/dev/TS/src/competion.ts
"TSS command processing error: TypeError: Cannot read property 'memberName' of null"
> type 1 21 C:/dev/TS/src/competion.ts
"string"
> definition 1 21 C:/dev/TS/src/competion.ts
{"def":{"unitIndex":1,"minChar":0,"limChar":18,"kind":"variable","name":"s","co
ntainerKind":"","containerName":"__GLO"},"file":"C:/dev/TS/src/competion.ts","m
in":[1,1],"lim":[1,19]}
> completions true 1 21 C:/dev/TS/src/competion.ts
{"maybeInaccurate":false,"isMemberCompletion":true,"entries":[]}
> completions true 1 22 C:/dev/TS/src/competion.ts
{"maybeInaccurate":false,"isMemberCompletion":true,"entries":[]}
> completions false 1 22 C:/dev/TS/src/competion.ts
{"maybeInaccurate":false,"isMemberCompletion":false,"entries":[{"name":"void","
type":"void","kind":"keyword","kindModifiers":""},{"name":"bool","type":"bool",
"kind":"keyword","kindModifiers":""},{"name":"number","type":"number","kind":"k
eyword","kindModifiers":""},{"name":"string","type":"string","kind":"keyword","
kindModifiers":""},{"name":"any","type":"any","kind":"keyword","kindModifiers":
""},{"name":"null","type":"any","kind":"keyword","kindModifiers":""},{"name":"u
ndefined","type":"undefined","kind":"keyword","kindModifiers":""},{"name":"s","
type":"string","kind":"variable","kindModifiers":""}]}
quit
"TSS closing"

C:\dev\TS>

As you can see, I get a correct definition or type result, but member completion is empty.

Do you know what the problem can be? And maybe you can reproduce this error, too.

Thanks.

Suggestion and feedback request

Hi, I just posted this on codeplex, but found this repo and I though I should send it here too :)

I just published a tool I called tsmc. Basically, it allows you to configure modules, submodules and the dependencies between them and drive the compilation from there. I created it because I'm developing a large library and wanted to combine my classes into different modules and submodules allowing our projects to load only what they want (e.g. you can have a modals module which is also packed inside the ui module which in turn is available when you require the company_libs module).

The tool is already available through npm and it works, but there is still much to be done. Usually I'd wait until it's more mature to actually publish it, but since there are many options on how to deal with certain issues, I would like to hear the community and shape the tool in a way it's useful to more people than me. Even if you don't see yourself using it, if you can, please have a look and give me your opinion, it will be much appreciated!

A basic (really basic) documentation is available here: https://github.com/theblacksmith/tsmc/wiki

Thanks in advance to anyone which takes the time to check it out.

Update with Error reporting make auto-completion delay

I'm using Tss with Sublime Text (i made the plugin public here https://github.com/Railk/T3S ),and i just updated Tss with the latest revision and saw you added error reporting with update command.

Without error reporting the update+completions command where instantaneous but now there's a delay due to error checking taking some time. Would it be possible to have a update command without error reporting ?

Request for Simple Example

I've been experimenting with your typescript services and can't quite wrap my head around how to use it properly. I was wondering if you could create a simple 'test' folder and, in it, provide a basic typescript file and a README with instructions about how to execute commands on the methods and sources within.

But perhaps I'm simply doing something wrong: After loading the server, when attempting this command:

definition 8 18 /usr/local/lib/node_modules/typescript-tools/tss.ts
"TSS command processing error: Error: Interal error: No AST found for file "/usr/local/lib/node_modules/typescript-tools/tss.ts"."

I get an AST error.

Any help would be appreciated.

showError command with maxCount or per file

I tested Typescript-tools (and my plugin) on a project with lots of errors (especially the Generic type references must include all type arguments they introduce recently, i think) and tss command line or my plugin stall and become unresponsive, the numbers of errors must be really high.

Could there be a maxcount or a showError per file to limit the numbers of errors ?

create mailing list?

Would people be interested if I created a mailing list for typescript-tools? For finding plugins, finding collaborators, etc. - all the things that this issue tracker isn't good for?

tss 1.4: test for undefined instead of null

Hey

  private updateScript(fileName: string, content: string) {
      var script = this.fileNameToScript[fileName];
      if (script !== null) {
        script.updateContent(content);
      } else {
        this.fileNameToScript[fileName] = new harness.ScriptInfo(fileName, content);
      }
      this.snapshots[fileName] = new harness.ScriptSnapshot(this.fileNameToScript[fileName]); 
  }

There are some occasions where you test script !== null, but

> var fn = {}
> fn
{}
> fn['ert']
undefined
> var k = fn['ert']
> k !== null
true
> k !== undefined
false

But ^^

> k == undefined
true
> k == null
true
> 

I can make a pull request if it is easier for you

Update of a file make completions return null for required module

I tested the last update of tss and had a little problem compare to last update.

When a file with some external required module is updated before completions the completions command always return null for the required module. (reference path is ok)

Exemple : (tested with command line and my plugin)
i put a internal test class to see if completions was working after the update and it is

/// <reference path="../../../../../../library/js/silns/silns.d.ts" />

// IMPORT
import Background = require('background');
import Navigation = require('navigation');
import Animate = require('animate');


class Test {

    public test_var:Silns;

    constructor(){

    }

    public test_method(){

    }
}

// MAIN
$(function(){

    // BACKGROUND IMAGE
    var bg = new Background();
    bg.init();

    // NAVIGATION
    var nav =  new Navigation();
    nav.init();

    // INIT ANIMATIONS
    var societe = new Animate.Societe();
    var works = new Animate.Works();

    // SOCIETE
    societe.start();
    works.init();

    var test = new Test()
    test.test_method();

});

The log of tss

Bash@ /d/X_DEVELOPPEMENT_X/xxxxxx/assets/js/front/index $ tss main.ts
"loaded d:/X_DEVELOPPEMENT_X/xxxxxx/assets/js/front/index/main.ts, TSS listening.."

> completions true 27 5 d:/X_DEVELOPPEMENT_X/xxxxxx/assets/js/front/index/main.ts
{"maybeInaccurate":false,"isMemberCompletion":true,"entries":[{"name":"init","kind":"method","kindModifiers":"public","type":"(): Background","fullSymbolName":"Background.init","docComment":"INIT"}]}
update 44 d:/X_DEVELOPPEMENT_X/WWW/xxxxxx/assets/js/front/index/main.ts

"exact same content as the file loaded"

"updated d:/X_DEVELOPPEMENT_X/xxxxxx/assets/js/front/index/main.ts, (0/8) errors"
> completions true 27 5 d:/X_DEVELOPPEMENT_X/xxxxxx/assets/js/front/index/main.ts
null
> completions true 42 7 d:/X_DEVELOPPEMENT_X/xxxxxx/assets/js/front/index/main.ts
{"maybeInaccurate":false,"isMemberCompletion":true,"entries":[{"name":"test_var","kind":"property","kindModifiers":"public","type":"Silns","fullSymbolName":"Test.test_var","docComment":""},{"name":"test_method","kind":"method","kindModifiers":"public","type":"(): void","fullSymbolName":"Test.test_method","docComment":""}],"prefix":"t"}

Error detected while processing function TSSdef

When I run TSSdef over a function defined in another file, it occasionally fails. I've also noticed that the autocomplete has given up at this point. I use typescript-tools together with YouCompleteMe. It usually works fine but fails sometimes.

Error detected while processing function TSSdef:
line 5:
TSS command processing error: TypeError: Cannot call method 'map' of null

Update: Actually it seems like nothing works after updating my plugin through Vundle. I've updated the plugin and the global npm package to the most recent version.

Reference file error

Hello,

I have a problem with reference file (i'm sure i've seen a discution about this problem, but cannot find it in the closed issues. Sorry if there's already an answer to that)

  1. I load a file with a reference file that cannot be resolved, showErrorsindicate the error.
  2. I then update this reference file name to be correct and use showErrors and i can still see the error.
  3. i reload the project and use ShowErrors and can still see the error.

Should i do something more to do not have the error showing after the reload ?

Bash@ /d/X_DEVELOPPEMENT_X/jscipt_developpement/TYPESCRIPT/TSS/reference $ tss main.ts
"loaded d:/X_DEVELOPPEMENT_X/jscipt_developpement/TYPESCRIPT/TSS/reference/main.ts, TSS listening.."

showErrors
[{"file":"d:/X_DEVELOPPEMENT_X/jscipt_developpement/TYPESCRIPT/TSS/reference/main.ts","start":{"line":1,"character":1},"end":{"line":1,"character":42},"text":"error TS5007: Cannot resolve referenced file: 'underscore-.d.ts'.","phase":"Resolution","category":"Error"}]

> update 1 main.ts
/// <reference path="underscore-1.4.d.ts" />
"updated d:/X_DEVELOPPEMENT_X/jscipt_developpement/TYPESCRIPT/TSS/reference/main.ts, (0/0) errors"

showErrors
[{"file":"d:/X_DEVELOPPEMENT_X/jscipt_developpement/TYPESCRIPT/TSS/reference/main.ts","start":{"line":1,"character":1},"end":{"line":1,"character":42},"text":"error TS5007: Cannot resolve referenced file: 'underscore-.d.ts'.","phase":"Resolution","category":"Error"}]

> dump ouput.txt main.ts
"dumped d:/X_DEVELOPPEMENT_X/jscipt_developpement/TYPESCRIPT/TSS/reference/main.ts to ouput.txt"

reload
"reloaded d:/X_DEVELOPPEMENT_X/jscipt_developpement/TYPESCRIPT/TSS/reference/main.ts, TSS listening.."

showErrors
[{"file":"d:/X_DEVELOPPEMENT_X/jscipt_developpement/TYPESCRIPT/TSS/reference/main.ts","start":{"line":1,"character":1},"end":{"line":1,"character":42},"text":"error TS5007: Cannot resolve referenced file: 'underscore-.d.ts'.","phase":"Resolution","category":"Error"}]

main.ts

/// <reference path="underscore-.d.ts" />

updated to:

/// <reference path="underscore-1.4.d.ts" />

underscore-1.4.d.ts

declare var _:string;

tss shows error on code which passes tsc compiler just fine

Hi. I am new to typescript. I have code which compiles just fine using command-line tsc or inside webstorm, but fails in VIM with typescript-tools when I run :TSSstarthere

Where I should start debugging? For one I see that typescript-tools seems to be based on 0.9x version of TS, while we use typescript 1.0.1. What is the process of updating typescript compiler in typescript-tools?

Angular.d.ts seems to break completion.

This is a bug report against the testing_ts1.4 branch.

Create a single file named blub.ts containing one line:

/// <reference path='libs/angularjs/angular.d.ts' />

This references https://github.com/borisyankov/DefinitelyTyped/blob/master/angularjs/angular.d.ts which is put into the correct sub directory: libs/angularjs.

Running :TSSstarthere:

:TSSstarthere
starting TSS, loading client/blub.ts...
['tss', 'client/blub.ts']
"loaded /Users/sirver/Desktop/Programming/rust/web_stack/client/blub.ts, TSS listening.."
Error detected while processing function TSSstart..TSSshowErrors:
line   16:
TSS command processing error: TypeError: undefined is not a function

This is on a very recent from HEAD build of MacVim.

add support for getEmitOutput

moved from #39, suggested by @Phaiax:

Hey.
I just looked at the last example here:
https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API

The LanguageService Object has a function called getEmitOutput. One could use the already parsed code tree to compile (hopefully) faster.
This would need a new command for tss.js and the ability to configure the CompilerOptions via tss.js. (settings source maps, ecma target, ...).

I've looked at the TypeScript source and at your changes and I think I could even implement it by myself, if you think this is a good idea and you do not want to do the work.

What do you think?

reload is completely broken

The reload command tries to restart the internal project data from scratch, but fails.

There is some global state hidden somewhere that survives in spite of trying to new everything.
Help on finding and eliminating that global state would be appreciated.

Errors not reporting properly if file contains an unclosed string

Using https://github.com/jlujan/TypeScriptServiceExample as a base, apparently it should provide the errors Could not find symbol 'foo' and Missing close quote character.
Using the compiler as a base it provides the error error TS1002: Missing close quote character

test case:

update 1 D:/tests.ts
foo = 'bar
showErrors

result:

"loaded D:/test.ts, TSS listening.."
"updated D:/tests.ts"
"TSS command processing error: Error: error TS5028: Argument out of range: position."

Looking into this I also noticed that there are errors that cause the script to fail compilation, and there are errors that are shown at compilation time but do not prevent it, would there be any way to differentiate those two through the typescript services?

TypeError: Cannot read property 'arguments' of undefined

with 243b081

matej@mitmanek: ~$ tss

/usr/lib/node_modules/typescript-tools/bin/tss.js:38227
if (TypeScript.Environment.arguments.indexOf("--version") !== -1) {
                          ^
TypeError: Cannot read property 'arguments' of undefined
    at Object.<anonymous> (/usr/lib/node_modules/typescript-tools/bin/tss.js:38227:27)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/lib/node_modules/typescript-tools/bin/tss:2:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
matej@mitmanek: ~$ tsc --version
message TS6029: Version 1.1.0.1
matej@mitmanek: ~$

Omnicomplete function API isn't correct

Hi!

Great program but I think omnifunc API isn't correct.
In vim documentations it is written that

On the first invocation the arguments are:
a:findstart 1
a:base empty

The function must return the column where the completion starts. (...)
Return -1 if no completion can be done.

I'm trying to get completition for greeter var (line 12) in test Typescript file

I'm using YouCompleteMe and it sends 1 and "" to omnicomplete function (TSScompleteFunc). But TScompleteFunc returns -1 and YouCompleteMe correctly assumes that no completitions can be done. If I press ctrl Space I get completitions but those are without YouCompleteMe substring search. If I comment this check in YouCompleteMe completition works. But I think problem is with typescript tools.

split tss and vim into separate repos?

Sometime after the TS1.5 update, we should perhaps split up the repo. So far that hasn't felt urgent, as the single vim-specific file doesn't add weight, and commits (with a few exceptions - oops) tend to be marked and split into vim-specific and general aspects, so can be filtered. Also, the Vim aspect is the part that motivates me to work on the tss part, it provides both a real-world test case and example, and non-Vim users tended to follow their own editor-plugin repos (so only the non-Vim plugin authors were exposed to possibly irrelevant info).

The best argument in favour of a split comes from those following the repo: I'm not sure how well the repo feed can be filtered for non-vim specific info (I've now started adding labels, so you can filter issues by using -label:vim). Also, since stars seem to double every year, I'm no longer sure of the audience interests.

Btw, if you're watching here, could you add a quick line to this issue stating whether you're following

  • because of the Vim plugin
  • because of tss only (what are you using it for? are you a plugin author? please link to your plugin)

Turn off build tool?

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 typescript-tools from running a build.
i sometimes accidentally hit the key combination and it runs, but it doesnt work they way i want to .

thanks for the great work
regards

Error detected while processing function TSSstart

I try to run the TSSstarthere in vim but I get the following:

starting TSS, loading app/scripts/app.ts...
['tss', 'app/scripts/app.ts']
Error detected while processing function TSSstart...TSSshowErrors:
line 16:
TSS not running

I'm on Manjaro Linux (Arch based)

copied this into my .vimrc

au BufRead,BufNewFile *.ts setlocal filetype=typescript
set rtp+=/usr/lib/node_modules/typescript-tools/

it runs fine in in the terminal if I type the 'tss' command but not in the latest version of Vim

Asking for completions on variable declaration gives an error instead of null

It probably should be the same as when asking for completion inside a function parameter, that will instead return null.

It does the same when asking for completions inside a string.

Test case:

update 1 D:/empty.ts
var t
completions false 1 6 D:/empty.ts

Results:

"updated D:/empty.ts"
"TSS command processing error: TypeError: Cannot set property 'prefix' of null"

Multiple node.js instances

First of all, thanks for doing this - your plugin is an excellent help when working with Typescript.

One problem, though ; Vim 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 vim opens additional node instances).

To cope with this, I have setup a key mapping (F8) to only invoke TSSstarthere on the files I want to edit - and not just to the ones I navigate to. In plain words, I don't have TSSstarthere in a 'BufNewFile/BufRead *.ts' event - which means I have to wait for tss to process the file each time I press F8. At least this way I have some control over how many node instances are spawned.

What I wanted to ask is, is there a way to "feed" all the .ts files in a single node instance of tss, and have Vim "speak" to that alone? This would be significantly better for working with my codebase - which numbers in the tens of MBs of typescript code...

Thanks in advance.

Parameter completion

Would it be/is it possible to complete/list function parameters for the Vim plugin? README.md mentions the function TSScompleteFunc, but it's not entirely clear what it does.

Errors running any command

I am trying to use this bundle on Debian testing, but ran into the following error:

Error detected while processing function TSSbrowse..TSScmd:
line   45:
Traceback (most recent call last):
  File "<string>", line 2, in <module>
NameError: name 'vim' is not defined
line   46:
E121: Undefined variable: result
E15: Invalid expression: result
0

I am sure that there is something wrong with my setup, but I can't figure it out.

My vim setup is here (https://bitbucket.org/bartj/vim) in case it is caused by a plugin conflict although I haven't committed typescript-tools because of this problem.

Any ideas?

can I use this in the browser?

This may be a silly question, but I'm looking to build a typescript webapp that can display information about all the accessable classes and methods of the app itself. To do so I want to keep a representation of the classes/methods of the app in the database.

I am coding on windows, and would like to check for any changes in the app every time I compile and run it. So my thinking is: if I include tts.js in my project and call some function of tts, I can get the json output of my .ts files at runtime... Would that be possible? Or would you suggest a different workflow?

Errors not showing correctly after update

After updating the file some errors stop appearing.

Test case:
Create empty file test.ts and run the following:

D:\> tss .\test.ts
"loaded D:/test.ts, TSS listening.."
> update 2 D:/tests.ts
> for(;;)
> 
"updated D:/tests.ts"
>showErrors
[{"file":"D:/tests.ts","start":{"line":2,"character":1},"end":{"line":2,"character":1},"text":"error TS1003: Identifier expected."}]
> update 2 D:/tests.ts
> for(;;)
> ;
"updated D:/tests.ts"
> showErrors
[]
> update 2 D:/tests.ts
> for(;;)
> 
"updated D:/tests.ts"
> showErrors
[]

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.