TransWikia.com

atom-editorで Omnisharp-atom を使うために dnvm を導入しようとするとエラーが出る

スタック・オーバーフロー Asked by YUTA on November 30, 2021

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

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

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

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

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.

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

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

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

追記1

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

参考にした結果、

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

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

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

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

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

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.

追記2

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を起動した直後、以下の2つ警告がホップアップされました。

No1.

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

No2.

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.

使用機器・atomに関して

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

atom:Version 1.25.0 is the latest version.


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

One Answer

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

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

// var grammars = atom.grammars;
var grammars = atom.grammars.textmateRegistry || atom.grammars;
//atom.grammars.startIdForScope(grammar.scopeName);
grammars.startIdForScope(grammar.scopeName);

Answered by Sunday programmer on November 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP