

atomにOmniSharp-atomを正常にプラグイン出来る手順を教えていただきたいです。

以下のサイトの手順に従って作業を行なっていました。

<https://note.nkmk.me/c-sharp-mac-atom-omnisharp/>

MONOのインストールは正常に完了しました。

[code]

    YUTA-no-MacBook-Pro:~ YUTA$ mono
    Usage is: mono [options] program [program-options]
    
    Development:
        --aot[=<options>]      Compiles the assembly to native code
        --debug[=<options>]    Enable debugging support, use --help-debug for details
        --debugger-agent=options Enable the debugger agent
        --profile[=profiler]   Runs in profiling mode with the specified profiler module
        --trace[=EXPR]         Enable tracing, use --help-trace for details
        --jitmap               Output a jit method map to /tmp/perf-PID.map
        --help-devel           Shows more options available to developers
    
    Runtime:
        --config FILE          Loads FILE as the Mono config
        --verbose, -v          Increases the verbosity level
        --help, -h             Show usage information
        --version, -V          Show version information
        --runtime=VERSION      Use the VERSION runtime, instead of autodetecting
        --optimize=OPT         Turns on or off a specific optimization
                               Use --list-opt to get a list of optimizations
        --security[=mode]      Turns on the unsupported security manager (off by default)
                               mode is one of cas, core-clr, verifiable or validil
        --attach=OPTIONS       Pass OPTIONS to the attach agent in the runtime.
                               Currently the only supported option is 'disable'.
        --llvm, --nollvm       Controls whenever the runtime uses LLVM to compile code.
        --gc=[sgen,boehm]      Select SGen or Boehm GC (runs mono or mono-sgen)
        --arch=[32,64]         Select architecture (runs mono32 or mono64)
        --handlers             Install custom handlers, use --help-handlers for details.
        --aot-path=PATH        List of additional directories to search for AOT images.
    
[/code]

しかし、問題が浮上しました。Homebrewからdnvmをインストールしようとしてる時です。

[code]

    YUTA-no-MacBook-Pro:~ YUTA$ brew install dnvm
    Updating Homebrew...
    ==> Auto-updated Homebrew!
    Updated 1 tap (homebrew/core).
    ==> Updated Formulae
    rancher-cli                telegraf                   traefik
    
    ==> Installing dnvm from aspnet/dnx
    ==> Cloning https://github.com/aspnet/Home.git
    Updating /Users/YUTA/Library/Caches/Homebrew/dnvm--git
    ==> Checking out branch dev
    Error: No such file or directory - dnvm.sh
    
[/code]

問題発覚の時点からatomにOmniSharp-atomを正常にプラグイン出来るまでの手順を細かく教えてほしいです。

## 追記１

問題発覚後、以下のサイトを参考にしました。

参考にした結果、

①.NET Core SDK ver2.0をインストール。

※以下インストールに使用したページ  
<https://www.microsoft.com/net/learn/get-started/macos#macos>

②Omnisharp-atomのパッケージをatomにプラグイン。

※atomエディタからインストールできるパッケージ。

③一度atomを終了させ、数分後atomを起動した直後、以下の警告がホップアップされました。

[code]

    Failed to activate the omnisharp-atom package
    
    
    atom.grammars.startIdForScope is not a function
    Hide Stack Trace
    
    TypeError: atom.grammars.startIdForScope is not a function
        at grammarCb (/Users/YUTA/.atom/packages/omnisharp-atom/dist/omnisharp-atom.js:145:35)
        at arrayEach (/Users/YUTA/.atom/packages/auto-encoding/node_modules/lodash/lodash.js:508:11)
        at forEach (/Users/YUTA/.atom/packages/auto-encoding/node_modules/lodash/lodash.js:9334:14)
        at OmniSharpAtom.activate (/Users/YUTA/.atom/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 Promise (<anonymous>)
        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 packagesToEnable.forEach.name (/Applications/Atom.app/Contents/Resources/app/src/package-manager.js:440:51)
        at Array.forEach (native)
        at disabledPackagesSubscription.config.onDidChange (/Applications/Atom.app/Contents/Resources/app/src/package-manager.js:440:30)
        at emitter.on (/Applications/Atom.app/Contents/Resources/app/src/config.js:1023:22)
        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 Config.emitChangeEvent (/Applications/Atom.app/Contents/Resources/app/src/config.js:1175:62)
        at Config.setRawValue (/Applications/Atom.app/Contents/Resources/app/src/config.js:1008:23)
        at Config.set (/Applications/Atom.app/Contents/Resources/app/src/config.js:711:18)
        at Config.removeAtKeyPath (/Applications/Atom.app/Contents/Resources/app/src/config.js:901:16)
        at Package.enable (/Applications/Atom.app/Contents/Resources/app/src/package.js:75:30)
        at PackageManager.enablePackage (/Applications/Atom.app/Contents/Resources/app/src/package-manager.js:246:18)
        at HTMLButtonElement.enablementButtonClickHandler (/Applications/Atom.app/Contents/Resources/app/node_modules/settings-view/lib/package-card.js:362:31)
    
    The error was thrown from the omnisharp-atom package. This issue has already been reported.
    
[/code]

## 追記２

3/18-22:00現在以下のサイトを参考にし、下記の作業を実行しました。

<https://github.com/OmniSharp/omnisharp-atom/issues/1020>

「koxu1996 commented 5 days ago ~Simple solution~」より

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

②一度atomを終了させ、数分後atomを起動した直後、以下の２つ警告がホップアップされました。

No1.

[code]

    Failed to load a language-csharp package grammar
    atom.grammars.startIdForScope is not a function in /Applications/Atom.app/Contents/Resources/app.asar/node_modules/language-csharp/grammars/csx.json
    Hide Stack Trace
    TypeError: atom.grammars.startIdForScope is not a function
        at grammarCb (/Users/YUTA/.atom/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 CSON.readFile (/Applications/Atom.app/Contents/Resources/app/src/grammar-registry.js:468:15)
        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:497:9
        at FSReqWrap.wrapper [as oncomplete] (fs.js:629:17)
      　at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/language-csharp/grammars/csx.json:1:1
    The error was thrown from the language-csharp package. This issue has already been reported.
    View Issue
    
[/code]

No2.

[code]

    Failed to load a language-csharp package grammar
    atom.grammars.startIdForScope is not a function in /Applications/Atom.app/Contents/Resources/app.asar/node_modules/language-csharp/grammars/csharp.json
    Hide Stack Trace
    TypeError: atom.grammars.startIdForScope is not a function
        at grammarCb (/Users/YUTA/.atom/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 CSON.readFile (/Applications/Atom.app/Contents/Resources/app/src/grammar-registry.js:468:15)
        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:497:9
        at FSReqWrap.wrapper [as oncomplete] (fs.js:629:17)
      at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/language-csharp/grammars/csharp.json:1:1
    The error was thrown from the language-csharp package. This issue has already been reported.
    
[/code]

## 使用機器・atomに関して

PC:MacBook Pro (Retina, 13-inch, Early 2015)  
OS:macOS Sierra ver10.12.16

atom:Version 1.25.0 is the latest version.

* * *

編集作業に携わってくださっている皆様、ありがとうございます。お疲れの出ない範囲で協力をよろしくお願いいたします。


CC BY-SA 3.0
2018-03-16T07:11:23.550
42434
2022-04-19T05:00:40.063
2018-03-18T23:25:47.657
19110
27766
question
.net atom-editor
atom-editorで Omnisharp-atom を使うために dnvm を導入しようとするとエラーが出る


<https://github.com/OmniSharp/omnisharp-
atom/issues/1037#issuecomment-487233117>

omnisharp-atom.jsの２箇所を変更しまして正常動作を確認しました。  
ご参考になれば幸いです。

[code]

    // var grammars = atom.grammars;
    var grammars = atom.grammars.textmateRegistry || atom.grammars;
    
[/code]

[code]

    //atom.grammars.startIdForScope(grammar.scopeName);
    grammars.startIdForScope(grammar.scopeName);
    
[/code]


CC BY-SA 4.0
2020-06-20T14:11:06.353
67838
2020-06-21T04:22:43.430
2020-06-21T04:22:43.430
13199
40749
42434
answer