atom-typescript icon indicating copy to clipboard operation
atom-typescript copied to clipboard

atom-typescript installed but no autocomplete, no format code, only get the typescript status bar

Open samuelneff opened this issue 11 years ago • 25 comments

I installed atom-typescript and when I open a TS file I do get the TypeScript status bar on the bottom that says "Error In Open Files" and "Last Build Output" and such.

I don't get any autocomplete though. Nothing pops up at all as I type. Nothing pops up when I hover over variables, go to declaration doesn't work, pretty much nothing works except for the status bar.

The status bar does update as I type (mostly just "Js emit is outdated" and "Js emit is up to date").

Initially I did not have any tsconfig.json file. I added one to the root with mostly default options and an exclude for node modules. I still had the problem so I replaced the tsconfig.json with empty options, {}. Still same issue.

What can I look into to resolve what's going on? Seems like it must be something wrong with my setup (I just installed Atom today, was using WebStorm previously).

Thanks,

Sam

atom-typescript\package.json snippet (too long to post full file)

{
  "name": "atom-typescript",
  "version": "6.0.0",
  "main": "./dist/main/atomts",
  "bin": {
    "atbuild": "./dist/main/bin/atbuild"
  },
  "preferGlobal": "true",
  "description": "The only TypeScript plugin you will ever need.",
  "engines": {
    "atom": ">=0.199.0 <2.0.0",
    "node": "*"
  },
  "providedServices": {
    "autocomplete.provider": {
      "versions": {
        "2.0.0": "provide"
      }
    },
    "linter": {
      "versions": {
        "1.0.0": "provideLinter"
      }
    }
  },
  "consumedServices": {
    "snippets": {
      "versions": {
        "0.1.0": "consumeSnippets"
      }
    }
  },
  ...
  "dependencies": {
    "atom-package-dependencies": "https://github.com/basarat/atom-package-dependencies/archive/cb2.tar.gz",
    "atom-space-pen-views": "^2.0.4",
    "babel": "^5.6.23",
    "basarat-text-buffer": "6.0.0",
    "d3": "^3.5.5",
    "emissary": "^1.3.3",
    "escape-html": "^1.0.1",
    "fuzzaldrin": "^2.1.0",
    "glob-expand": "0.0.2",
    "htmltojsx": "0.2.4",
    "immutable": "^3.7.3",
    "json2dts": "0.0.1",
    "mkdirp": "^0.5.0",
    "ntypescript": "1.201508230720.1",
    "react": "^0.13.3",
    "season": "^5.1.4",
    "strip-bom": "^2.0.0"
  },
  ...
}

samuelneff avatar Aug 30 '15 18:08 samuelneff

I don't get any autocomplete though. Nothing pops up at all as I type.

Did you get the message : AtomTS: Dependencies installed correctly. Enjoy TypeScript ♥

Ref : https://github.com/TypeStrong/atom-typescript#installation :rose:

basarat avatar Aug 31 '15 02:08 basarat

I am having the exact same issue. I installed the typescript package in the manner described on the README but I still have no autocomplete or hover functionality. I did not see the AtomTS: Dependencies installed correctly. Enjoy TypeScript ♥ message displayed.

ggrumbley avatar Oct 20 '15 15:10 ggrumbley

I had the same issue. it's seems to be related to permissions. the only way i get it to work successfully was to start the atom from the project folder with "sudo" command.

sudo atom ./

and the autocomplete started to work as expected. using the open project from the menu seems to cause some problems.

eliorcohen avatar Nov 23 '15 13:11 eliorcohen

Wow, I just realized how much better atom-typescript is when you launch atom with sudo!

Would be nice not to have to do this, though.

laurelnaiad avatar Nov 27 '15 19:11 laurelnaiad

I'm experiencing this issue as well. I tried installing atom-typescript through the UI then removed it and tried installing through CLI. The CLI install resulted in: Installing atom-typescript to /Users/willhitchcock/.atom/packages ✓ but not the AtomTS: Dependencies installed correctly. Enjoy TypeScript ♥ readout mentioned above. I also tried opening atom with sudo atom ./, no luck there.

hitchcockwill avatar Dec 10 '15 20:12 hitchcockwill

Anyone have any stack trace (open dev tools https://github.com/TypeStrong/atom-typescript/blob/master/CONTRIBUTING.md#workflow) :rose:

basarat avatar Dec 11 '15 03:12 basarat

Just installed the development version and rebooted. I'm getting a few errors in the console:

Error: Project file contains invalid options
    at Object.getProjectSync (/Users/willhitchcock/Projects/Development/atom-typescript/dist/main/tsconfig/tsconfig.js:260)
    at getOrCreateProjectFile (/Users/willhitchcock/Projects/Development/atom-typescript/dist/main/lang/projectCache.js:74)
    at Object.getOrCreateProject (/Users/willhitchcock/Projects/Development/atom-typescript/dist/main/lang/projectCache.js:141)
    at Object.getCompletionsAtPosition (/Users/willhitchcock/Projects/Development/atom-typescript/dist/main/lang/projectService.js:104)
    at Child.RequesterResponder.processRequest (/Users/willhitchcock/Projects/Development/atom-typescript/dist/worker/lib/workerLib.js:49)
    at process.<anonymous> (/Users/willhitchcock/Projects/Development/atom-typescript/dist/worker/lib/workerLib.js:227)
    at emitTwo (events.js:87)
    at process.emit (events.js:172)
    at handleMessage (internal/child_process.js:685)
    at Pipe.channel.onread (internal/child_process.js:440)

and

Uncaught (in promise)

{
  "method": "getOutputJsStatus",
  "message": "Project file contains invalid options",
  "stack": "Error: Project file contains invalid options\n    at Object.getProjectSync (/Users/willhitchcock/Projects/Development/atom-typescript/dist/main/tsconfig/tsconfig.js:260:32)\n    at getOrCreateProjectFile (/Users/willhitchcock/Projects/Development/atom-typescript/dist/main/lang/projectCache.js:74:36)\n    at Object.getOrCreateProject (/Users/willhitchcock/Projects/Development/atom-typescript/dist/main/lang/projectCache.js:141:27)\n    at Object.getOutputJsStatus (/Users/willhitchcock/Projects/Development/atom-typescript/dist/main/lang/projectService.js:602:34)\n    at Child.RequesterResponder.processRequest (/Users/willhitchcock/Projects/Development/atom-typescript/dist/worker/lib/workerLib.js:49:60)\n    at process.<anonymous> (/Users/willhitchcock/Projects/Development/atom-typescript/dist/worker/lib/workerLib.js:227:23)\n    at emitTwo (events.js:87:13)\n    at process.emit (events.js:172:7)\n    at handleMessage (internal/child_process.js:685:10)\n    at Pipe.channel.onread (internal/child_process.js:440:11)",
  "details": {
    "projectFilePath": "/Users/willhitchcock/Projects/Development/proeditors-CustomerUI/tsconfig.json",
    "errorMessage": "Unknown Option: compileOnSave"
  }
}

I'm seeing this second error message several times with different methods: getCompletionsAtPosition getProjectFileDetails editText

hitchcockwill avatar Dec 11 '15 14:12 hitchcockwill

I'm seeing this second error message several times with different methods:

@hitchcockwill sorry for the late reply. That is by design. We are just erroring out on invalid projects. We show a message for this as well :

image

That if you click would guide you to the fix. Basically you have something like :

{
    "compilerOptions": {
        "compileOnSave": false,
        "target": "es5",
        "module": "commonjs",
        "declaration": false,
        "noImplicitAny": false,
        "removeComments": true,
        "noLib": false
    },

When you should have :

{
    "compileOnSave": false,
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "declaration": false,
        "noImplicitAny": false,
        "removeComments": true,
        "noLib": false
    },

@hitchcockwill docs : https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md#options. So that fixes your error :rose:

Anybody else got a stacktrace with a valid error ? : rose: If not I will close this.

basarat avatar Dec 13 '15 23:12 basarat

After making that change in the tsconfig file I started getting autocomplete suggestions as expected in my .ts files. They are pretty slow, but they do work.

hitchcockwill avatar Dec 14 '15 16:12 hitchcockwill

@hitchcockwill check that the tsconfig is not touching all files. See FAQ https://github.com/TypeStrong/atom-typescript/blob/master/docs/faq.md#for-really-large-projects-atom-typescript-gets-slow for details :rose:

We should probably be easily able to figure out the intent and understand that its a folder exclusion ourselves at some point :rose:

basarat avatar Dec 14 '15 22:12 basarat

Thanks @basarat I was having some other issues with the plugin and just discovered that I needed to configure my tsconfig. I've got it set up correctly now and everything seems to be working at lot better.

hitchcockwill avatar Dec 15 '15 02:12 hitchcockwill

Cool. Since no one else has reported back, closing this :rose:

basarat avatar Dec 15 '15 02:12 basarat

There was no error displayed on atom until I opened the tsconfig.json Wouldn't it be nice if we show a message to know why the autocomplete isn't working?

canda avatar May 30 '16 06:05 canda

For atom-typescript and any new typescript project in general, for things like autocomplete to work correctly, you must have a tsconfig.json file. atom-typescript has a command to generate you a file, when you're editing a .ts file.

Press Ctrl+Shift+P and type create file and click on the first result from typescript

gurumohanreddy avatar Jun 26 '16 17:06 gurumohanreddy

For anyone that stumbles across this on a Google search and is looking for a solution on Windows 7, just give it time. When I installed and started working on an existing project it took a couple of minutes for Atom to process through a number of items in the status at the bottom. Once it finally got done with those then my autocomplete and related features started working.

jasoninrapid avatar Jul 13 '16 17:07 jasoninrapid

I pressed this button and it started working:

image

AskYous avatar Aug 20 '16 22:08 AskYous

Make sure you have a tsconfig.json either in the root of your project or in the directory in which you are working.

jasonmorita avatar Oct 11 '16 17:10 jasonmorita

I've got a tsconfig.json file in the root of my project directory:

 ~/a2_angular_projects/angular2-get-started

and this is it:

~/a2_angular2_projects/angular2-get-started$ cat tsconfig.json
{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true
  }
}

I'm trying to edit files in the directory:

~/a2_angular_projects/angular2-get-started/app

First, in the TypeScript area at the bottom of the editor, I see the message:

-tsconfig.json   X JS Outdated 

Sometimes it goes away, and then it just comes back (when I open another file?). Saving the file does not get rid of the message.

Second, the autocomplete does not work as shown in the demo. When I type out the same example shown:

 var foo = 123;
 var bar = foo.toString();

I don't see anything popping up (as in zero). If I type:

 var bar = foo.

and wait, then after at least 3 seconds and sometimes as long as 7 seconds, an autocomplete menu displays.

When I assign the wrong type to bar:

bar = 456;

I get no error. I save the file--still no error. Five minutes later, I get an error. Then after I delete that line, I still get the error. I actually have to type something on the line that I deleted in order to make the error go away (is that really the way it's supposed to work).

If I hover over something, sometimes I don't see the type(even after waiting for five seconds), and other times I see the type immediately.

Also, I cannot find a Recent Files list under the File menu, which would enable me to quickly open a project I worked on previously. Is that feature really missing?

Macbook Pro OSX 10.10.5 atom 1.13.0x64

7stud avatar Jan 14 '17 07:01 7stud

I wasn't getting any autocomplete at all. In the status bar, I clicked on "TypeScript", and it brought up a list of all languages supported....I noticed that there were two Typescript in the list. I clicked on the other one (the one that was not currently selected), and voila! Suddenly I started to get autocomplete functionality.

amhuhn2 avatar Mar 10 '17 22:03 amhuhn2

Changing this atom-typescript tsconfig.json worked for me. Under packages -> atom-typescript -> lib -> tsconfig.json

{

"compileOnSave": true,

"compilerOptions": { "forceConsistentCasingInFileNames": true, "importHelpers": true, "jsx": "react", "lib": ["es6", "dom"], "module": "commonjs", "noLib": false, "outDir": "../dist", "preserveConstEnums": true, "reactNamespace": "dom", "skipLibCheck": true, "sourceMap": false, "strict": true, "target": "es6" }, }

The "compileOnSave" line should be moved to the top and comma separated, similar to basarat's 2015 fix

DrCo avatar Mar 20 '17 18:03 DrCo