omnisharp-atom: Uncaught TypeError: atom.grammars.startIdForScope is not a function
Steps to reproduce:
- 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
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 17
@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!
Same on released production version 1.24 on Mac OS X:
[Enter steps to reproduce:]
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
Commands
Non-Core Packages
@koxu1996 's solution is really close
The
startIdForScopecall referencesatom.grammarsdirectly, so you need to switch it to justgrammarsas well.Simple solution
Replace 140 line of omnisharp-atom.js from:
var grammars = atom.grammars;tovar grammars = atom.grammars.textmateRegistry || atom.grammars;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.