OmniSharp / omnisharp-atom

Omnisharp support for the atom editor
https://atom.io/packages/omnisharp-atom
MIT License
318 stars 61 forks source link

Uncaught TypeError: atom.grammars.startIdForScope is not a function #1020

Open corydeppen opened 6 years ago

corydeppen commented 6 years ago

Steps to reproduce:

  1. Open Atom

Atom: 1.24.0-beta1 x64 Electron: 1.6.15 OS: Microsoft Windows 10 Enterprise Thrown From: omnisharp-atom package 0.31.2

Stack Trace

Uncaught TypeError: atom.grammars.startIdForScope is not a function

At C:\Users\[username]\.atom\packages\omnisharp-atom\dist\omnisharp-atom.js:145

TypeError: atom.grammars.startIdForScope is not a function
    at grammarCb (/packages/omnisharp-atom/dist/omnisharp-atom.js:145:35)
    at Function.module.exports.Emitter.simpleDispatch (~/AppData/Local/atom/app-1.24.0-beta1/resources/app/node_modules/event-kit/lib/emitter.js:25:20)
    at Emitter.module.exports.Emitter.emit (~/AppData/Local/atom/app-1.24.0-beta1/resources/app/node_modules/event-kit/lib/emitter.js:141:34)
    at GrammarRegistry.module.exports.GrammarRegistry.addGrammar (~/AppData/Local/atom/app-1.24.0-beta1/resources/app/node_modules/first-mate/lib/grammar-registry.js:80:26)
    at Grammar.module.exports.Grammar.activate (~/AppData/Local/atom/app-1.24.0-beta1/resources/app/node_modules/first-mate/lib/grammar.js:259:54)
    at grammarRegistry.readGrammar (~/AppData/Local/atom/app-1.24.0-beta1/resources/app/src/package.js:617:53)
    at ~/AppData/Local/atom/app-1.24.0-beta1/resources/app/node_modules/first-mate/lib/grammar-registry.js:126:61
    at parseContents (~/AppData/Local/atom/app-1.24.0-beta1/resources/app/node_modules/season/lib/cson.js:123:13)
    at ~/AppData/Local/atom/app-1.24.0-beta1/resources/app/node_modules/season/lib/cson.js:230:26
    at ELECTRON_ASAR.js:498:9
    at FSReqWrap.wrapper [as oncomplete] (fs.js:603:17)

Non-Core Packages

atom-ide-ui 0.7.0 
atom-material-syntax 1.0.8 
atom-material-ui 2.0.6 
autocomplete-paths 2.12.1 
busy-signal 1.4.3 
editorconfig 2.2.2 
emmet 2.4.3 
file-icons 2.1.15 
flatwhite-syntax 0.8.1 
flow-ide 1.9.0 
github-atom-light-syntax 0.5.0 
hyperclick 0.0.0 
ide-typescript 0.7.2 
intentions 1.1.5 
language-babel 2.81.1 
language-cshtml 0.3.0 
language-elm 1.5.0 
language-vue 0.23.1 
linter 2.2.0 
linter-eslint 8.4.0 
linter-ui-default 1.6.10 
markdown-writer 2.7.3 
monokai 0.24.0 
nova-atom-syntax 1.5.0 
nova-atom-ui 1.3.0 
oceanic-next 1.0.0 
omnisharp-atom 0.31.2 
prettier-atom 0.43.1 
react 0.17.0 
sync-settings 0.8.3 
quasiblob commented 6 years ago

Hi.

I get the same error message in Atom 1.24.0-beta3 x64 / Windows 10 Pro x64.

I've also tried Atom 1.23.3 x64 / Windows 10 Pro x64... and I get different error.

And package is omnisharp-atom 0.31.2

Either way, can't get OmniSharp icon turn green, and of course, intellisense etc doesn't work.

However, with Sublime Text 3 I can get omnisharp working, however, I have no idea what the difference or similarities between Atom and Sublime Text omnisharp are... if there are any similarities or such.

I'm pretty noob in anything coding, not even sure what .Net should be installed for omnisharp to work, I was going to try using atom as alternative IDE for Unity + C# use.

squio commented 6 years ago

Same on released production version 1.24 on Mac OS X:

[Enter steps to reproduce:]

  1. Start Atom
  2. Get big red bug alert

Atom: 1.24.0 x64 Electron: 1.6.16 OS: Mac OS X 10.13.3 Thrown From: omnisharp-atom package 0.31.2

Stack Trace

Uncaught TypeError: atom.grammars.startIdForScope is not a function

At ~/.atom/packages/omnisharp-atom/dist/omnisharp-atom.js:145

TypeError: atom.grammars.startIdForScope is not a function
    at grammarCb (/packages/omnisharp-atom/dist/omnisharp-atom.js:145:35)
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:25:20)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:141:34)
    at GrammarRegistry.module.exports.GrammarRegistry.addGrammar (/Applications/Atom.app/Contents/Resources/app/node_modules/first-mate/lib/grammar-registry.js:80:26)
    at Grammar.module.exports.Grammar.activate (/Applications/Atom.app/Contents/Resources/app/node_modules/first-mate/lib/grammar.js:259:54)
    at grammarRegistry.readGrammar (/Applications/Atom.app/Contents/Resources/app/src/package.js:617:53)
    at /Applications/Atom.app/Contents/Resources/app/node_modules/first-mate/lib/grammar-registry.js:126:61
    at parseContents (/Applications/Atom.app/Contents/Resources/app/node_modules/season/lib/cson.js:123:13)
    at /Applications/Atom.app/Contents/Resources/app/node_modules/season/lib/cson.js:230:26
    at ELECTRON_ASAR.js:498:9
    at FSReqWrap.wrapper [as oncomplete] (fs.js:603:17)

Commands

Non-Core Packages

angular-2-typeScript-snippets 0.7.0 
angular2-snippets 0.4.0 
atom-ide-ui 0.8.1 
atom-material-syntax-light 0.4.6 
atom-material-ui 2.1.1 
atom-typescript 12.1.2 
atom-yii2 0.4.0 
autocomplete-clang 0.11.4 
build 0.70.0 
busy-signal 1.4.3 
docblockr 0.13.6 
editorconfig 2.2.2 
file-icons 2.1.16 
hyperclick 0.0.0 
ide-csharp 0.6.1 
ide-json 0.2.0 
ide-php 0.7.5 
ide-python 0.7.0 
intentions 1.1.5 
language-ini 1.19.0 
language-matlab 0.2.1 
linter 2.2.0 
linter-eslint 8.4.1 
linter-gcc 0.7.1 
linter-php 1.5.1 
linter-tidy 2.3.1 
linter-tslint 1.9.0 
linter-ui-default 1.6.10 
nativescript-ng2-atom-snippets 1.2.0 
omnisharp-atom 0.31.2 
php-composer-completion 0.3.4 
php-cs-fixer 4.1.1 
php-integrator-annotations 1.2.0 
php-integrator-autocomplete-plus 1.6.2 
php-integrator-base 3.2.1 
php-integrator-refactoring 1.4.1 
platformio-ide-debugger 1.2.5 
platformio-ide-terminal 2.8.0 
prettier-atom undefined 
project-manager 3.3.5 
symbols-tree-view 0.14.0 
tool-bar 1.1.6 
webbox-color 0.5.9 
irrationalistic commented 6 years ago

I'm not sure if this is related, but I have a similar issue in my own package and have started a discussion on atom.io to see if there's any support: https://discuss.atom.io/t/function-this-registry-startidforscope-is-not-a-function/52441

atifaziz commented 6 years ago

I'm having the same issue.

Steps to reproduce:

  1. Launch Atom

Atom: 1.24.0 x64 Electron: 1.6.16 OS: Mac OS X 10.12.6 Thrown From: omnisharp-atom package 0.31.2

Stack Trace

Failed to activate the omnisharp-atom package

At atom.grammars.startIdForScope is not a function

TypeError: atom.grammars.startIdForScope is not a function
    at grammarCb (/packages/omnisharp-atom/dist/omnisharp-atom.js:145:35)
    at arrayEach (/packages/omnisharp-atom/node_modules/lodash/lodash.js:508:11)
    at forEach (/packages/omnisharp-atom/node_modules/lodash/lodash.js:9334:14)
    at OmniSharpAtom.activate (/packages/omnisharp-atom/dist/omnisharp-atom.js:153:30)
    at Package.activateNow (/Applications/Atom.app/Contents/Resources/app/src/package.js:230:33)
    at measure (/Applications/Atom.app/Contents/Resources/app/src/package.js:206:33)
    at Package.measure (/Applications/Atom.app/Contents/Resources/app/src/package.js:88:25)
    at activationPromise.Promise (/Applications/Atom.app/Contents/Resources/app/src/package.js:200:20)
    at Package.activate (/Applications/Atom.app/Contents/Resources/app/src/package.js:198:38)
    at PackageManager.activatePackage (/Applications/Atom.app/Contents/Resources/app/src/package-manager.js:695:42)
    at /Applications/Atom.app/Contents/Resources/app/node_modules/settings-view/lib/package-manager.js:535:35
    at exit (/Applications/Atom.app/Contents/Resources/app/node_modules/settings-view/lib/package-manager.js:128:22)
    at triggerExitCallback (/Applications/Atom.app/Contents/Resources/app/src/buffered-process.js:338:17)
    at /Applications/Atom.app/Contents/Resources/app/src/buffered-process.js:359:17
    at Socket.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/buffered-process.js:220:15)
    at emitOne (events.js:101:20)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:501:12)

Commands

     -1:13.9.0 core:select-all (input.hidden-input)
     -1:12.9.0 core:backspace (input.hidden-input)
  5x -1:03.9.0 core:move-left (input.hidden-input)
     -1:01.4.0 core:select-all (input.hidden-input)
     -0:59.3.0 core:move-right (input.hidden-input)
     -0:58.6.0 editor:move-to-beginning-of-word (input.hidden-input)
     -0:58.2.0 core:backspace (input.hidden-input)
     -0:57.9.0 core:confirm (input.hidden-input)

Non-Core Packages

busy-signal 1.4.3 
intentions 1.1.5 
linter 2.2.0 
linter-ui-default 1.6.10 
omnisharp-atom 0.31.2 
TheArchKnight commented 6 years ago

Im having the same issue, but i have Linux(Ubuntu), i have this problem since 2 weeks, and i was looking for solved this for all that time, this is what drop: [Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.24.0 x64 Electron: 1.6.16 OS: Ubuntu 16.04.3 Thrown From: omnisharp-atom package 0.31.2

Stack Trace

Uncaught TypeError: atom.grammars.startIdForScope is not a function

At /home/fenix/.atom/packages/omnisharp-atom/dist/omnisharp-atom.js:145

TypeError: atom.grammars.startIdForScope is not a function
    at grammarCb (/packages/omnisharp-atom/dist/omnisharp-atom.js:145:35)
    at Function.module.exports.Emitter.simpleDispatch (/usr/share/atom/resources/app/node_modules/event-kit/lib/emitter.js:25:20)
    at Emitter.module.exports.Emitter.emit (/usr/share/atom/resources/app/node_modules/event-kit/lib/emitter.js:141:34)
    at GrammarRegistry.module.exports.GrammarRegistry.addGrammar (/usr/share/atom/resources/app/node_modules/first-mate/lib/grammar-registry.js:80:26)
    at Grammar.module.exports.Grammar.activate (/usr/share/atom/resources/app/node_modules/first-mate/lib/grammar.js:259:54)
    at grammarRegistry.readGrammar (/usr/share/atom/resources/app/src/package.js:617:53)
    at /usr/share/atom/resources/app/node_modules/first-mate/lib/grammar-registry.js:126:61
    at parseContents (/usr/share/atom/resources/app/node_modules/season/lib/cson.js:123:13)
    at /usr/share/atom/resources/app/node_modules/season/lib/cson.js:230:26
    at ELECTRON_ASAR.js:498:9
    at FSReqWrap.wrapper [as oncomplete] (fs.js:603:17)

Commands

     -8:05.3.0 application:open-folder (atom-pane.pane.active)
     -0:41.3.0 editor:newline (input.hidden-input)
  3x -0:38 core:backspace (input.hidden-input)
  3x -0:33 editor:newline (input.hidden-input)

Non-Core Packages

busy-signal 1.4.3 
intentions 1.1.5 
linter 2.2.0 
linter-ui-default 1.6.10 
omnisharp-atom 0.31.2 
TheArchKnight commented 6 years ago

Ok i was searching the error and i found there is in the line 145 of the omnisharp-atom.js file, so we khow where is the error but... what is? I dont know about JS, maybe is a server error because the build is failing so.... captura de pantalla de 2018-02-20 20-55-07

icaspi commented 6 years ago

Same issue here [Enter steps to reproduce:]

  1. Start Atom

Atom: 1.24.0 x64 Electron: 1.6.16 OS: Mac OS X 10.12.6 Thrown From: omnisharp-atom package 0.31.2

Stack Trace

Failed to activate the omnisharp-atom package

At atom.grammars.startIdForScope is not a function

TypeError: atom.grammars.startIdForScope is not a function
    at grammarCb (/packages/omnisharp-atom/dist/omnisharp-atom.js:145:35)
    at arrayEach (/packages/omnisharp-atom/node_modules/lodash/lodash.js:508:11)
    at forEach (/packages/omnisharp-atom/node_modules/lodash/lodash.js:9334:14)
    at OmniSharpAtom.activate (/packages/omnisharp-atom/dist/omnisharp-atom.js:153:30)
    at Package.activateNow (/Applications/Atom.app/Contents/Resources/app/src/package.js:230:33)
    at measure (/Applications/Atom.app/Contents/Resources/app/src/package.js:206:33)
    at Package.measure (/Applications/Atom.app/Contents/Resources/app/src/package.js:88:25)
    at activationPromise.Promise (/Applications/Atom.app/Contents/Resources/app/src/package.js:200:20)
    at Package.activate (/Applications/Atom.app/Contents/Resources/app/src/package.js:198:38)
    at PackageManager.activatePackage (/Applications/Atom.app/Contents/Resources/app/src/package-manager.js:695:42)
    at config.transactAsync (/Applications/Atom.app/Contents/Resources/app/src/package-manager.js:670:36)
    at Config.module.exports.Config.transactAsync (/Applications/Atom.app/Contents/Resources/app/src/config.js:367:24)
    at PackageManager.activatePackages (/Applications/Atom.app/Contents/Resources/app/src/package-manager.js:668:23)
    at PackageManager.activate (/Applications/Atom.app/Contents/Resources/app/src/package-manager.js:647:50)
    at loadStatePromise.loadState.then (/Applications/Atom.app/Contents/Resources/app/src/atom-environment.js:841:27)

Commands

     -0:50.5.0 core:copy (atom-notification.fatal.icon.icon-bug.native-key-bindings.has-detail.has-close.has-stack)

Non-Core Packages

busy-signal 1.4.3 
intentions 1.1.5 
linter 2.2.0 
linter-ui-default 1.7.0 
nuclide 0.245.0 
omnisharp-atom 0.31.2 
leighghunt commented 6 years ago

Not meaning to be rude, but just wondering if this project has been dropped in favour of https://github.com/OmniSharp/omnisharp-vscode, as there hasn't been a commit here in over 10 months, and issues don't seem to be getting addressed?

I'd be possibly interested in helping move it from DNVM to DotNet CLI, which seems to be the cause of the latest build fail, but not if it's being deprecated.

koxu1996 commented 6 years ago

Simple solution

Replace 140 line of omnisharp-atom.js from: var grammars = atom.grammars; to var grammars = atom.grammars.textmateRegistry || atom.grammars;

ghost commented 6 years ago

Didn't work for me.

Eyap53 commented 6 years ago

Didn't work for me neither :/

Skehmatics commented 6 years ago

@koxu1996 's solution is really close

The startIdForScope call references atom.grammars directly, so you need to switch it to just grammars as well.

Eyap53 commented 6 years ago

It seems to solve that problem, thanks for both of you!

I have another error to start the package, though, which seems to be unrelated. I will open a new issue for that one.

mendes-jc commented 6 years ago

Simple solution

Replace 140 line of omnisharp-atom.js from: var grammars = atom.grammars; to var grammars = atom.grammars.textmateRegistry || atom.grammars;

@koxu1996 's solution is really close The startIdForScope call references atom.grammars directly, so you need to switch it to just grammars as well.

Thank you!! It worked for me!

theslyprofessor commented 5 years ago

Can you post the updated solution? I'm having trouble understanding.

Ainstain438 commented 4 years ago

@theslyprofessor I might be a little late, but I have gotten it to work by finding the file omnisharp-atom.js. It's located in the your-username/.atom/packages/omnisharp-atom/dist folder. If you don't find it there, try letting explorer search for omnisharp-atom.js in the whole drive, and it should find it ...

Anyway, find it and open it in a text editor, then search for "var grammars = atom.grammars;". This will take you to line 140. Replace that whole line with "var grammars = atom.grammars.textmateRegistry || atom.grammars;".

Then you shall move on to line 145, "atom.grammars.startIdForScope(grammar.scopeName);" and replace it with "grammars.startIdForScope(grammar.scopeName);". Then you save the file and relaunch Atom. Good luck and hope it works now!

Sxntx commented 3 years ago

@theslyprofessor is right but then if you have installed linder-ui-default it sends you and error like its something ilegal, u have to uninstall then it runs, but it someone knows how to avoid uninstall, please contact me thanks