-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add emacs format-all to Editors.md docs (#1159)
- Loading branch information
1 parent
b456544
commit b392e10
Showing
15 changed files
with
503 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import { execSync, ExecSyncOptionsWithBufferEncoding } from "child_process"; | ||
import { options } from "./Options"; | ||
import { Logger } from "./Logger"; | ||
import { getDotnetInfo } from "./vscode-csharp/getDotnetInfo"; | ||
import { findDotNetFromRuntimes } from "./vscode-csharp/findDotNetFromRuntimes"; | ||
|
||
export type ExecDotNet = ( | ||
command: string, | ||
options?: ExecSyncOptionsWithBufferEncoding | undefined, | ||
) => Buffer; | ||
|
||
export const getExecDotNet = async (logger: Logger): Promise<ExecDotNet | null> => { | ||
return await doDotNetInfoWay(logger); | ||
// | ||
// | ||
// const fileName = process.platform === "win32" ? "dotnet.exe" : "dotnet"; | ||
// const env = { ...process.env }; | ||
// | ||
// // TODO test without this but with a sym link | ||
// // TODO what about using the sh stuff? | ||
// const dotnetPathOption = options.dotnetPath; | ||
// if (dotnetPathOption.length > 0) { | ||
// env.PATH = dotnetPathOption + path.delimiter + env.PATH; | ||
// logger.debug("including " + options.dotnetPath + " in the path to test for dotnet"); | ||
// } | ||
// const dotNetCliPaths = options.dotNetCliPaths; | ||
// | ||
// for (const dotnetPath of dotNetCliPaths) { | ||
// env.PATH = env.PATH + path.delimiter + dotnetPath; | ||
// logger.debug("including " + dotnetPath + " in the path to test for dotnet"); | ||
// } | ||
// | ||
// let result: { stdout: string; stderr: string } = { stdout: "", stderr: "" }; | ||
// | ||
// try { | ||
// result = await promisify(exec)(`${fileName} --version`, { env }); | ||
// } catch (exception) { | ||
// result.stderr = exception as any; | ||
// } | ||
// | ||
// let useSH = false; | ||
// let foundDotnet = true; | ||
// if (result.stderr) { | ||
// logger.warn(`Unable to read dotnet version information. \n ${result.stderr}`); | ||
// useSH = true; | ||
// try { | ||
// result = await promisify(exec)(`sh -c "${fileName} --version"`, { env }); | ||
// } catch (exception) { | ||
// result.stderr = exception as any; | ||
// } | ||
// if (result.stderr) { | ||
// logger.warn( | ||
// `Unable to read dotnet version information using "sh -c". Error ${result.stderr}`, | ||
// ); | ||
// foundDotnet = false; | ||
// } | ||
// } | ||
// | ||
// if (!foundDotnet) { | ||
// return null; | ||
// } | ||
// | ||
// return (command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer => { | ||
// if (useSH) { | ||
// command = `sh -c "${command}"`; | ||
// } | ||
// | ||
// if (options === undefined) { | ||
// options = {}; | ||
// } | ||
// | ||
// if (options.env === undefined) { | ||
// options.env = { ...process.env }; | ||
// } | ||
// | ||
// options.env.PATH = env.PATH; | ||
// | ||
// return execSync(command, options); | ||
// }; | ||
}; | ||
|
||
// TODO we need to find dotnet via sh if these two options are not set and we can't find it, probably with runDotnetInfo | ||
async function doDotNetInfoWay(logger: Logger) { | ||
const dotNetCliPaths = options.dotNetCliPaths; | ||
const dotnetPathOption = options.dotnetPath; | ||
|
||
const dotnetInfo = await getDotnetInfo([dotnetPathOption, ...dotNetCliPaths]); | ||
logger.info(JSON.stringify(dotnetInfo, null, 4)); | ||
|
||
let dotnetExecutablePath = dotnetInfo.CliPath; | ||
if (!dotnetExecutablePath) { | ||
dotnetExecutablePath = findDotNetFromRuntimes(dotnetInfo); | ||
} | ||
|
||
return (command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer => { | ||
if (options === undefined) { | ||
options = {}; | ||
} | ||
|
||
return execSync(dotnetExecutablePath + " " + command, options); | ||
}; | ||
} | ||
|
||
/* | ||
bela@ubuntu-two:~/.dotnet$ find /usr -name "dotnet" -type f | ||
bela@ubuntu-two:~/.dotnet$ find ~ -name "dotnet" -type f | ||
whereis | ||
which | ||
install-script put it at with install script seems to go to ~/.dotnet | ||
gh user has it in /usr/bin, which seems like it should be standard | ||
after running | ||
sudo ln -s ~/.dotnet/dotnet /usr/bin/dotnet | ||
then I get | ||
You must install .NET to run this application. | ||
but it installed just fine | ||
global install has the same problem | ||
You must install .NET to run this application. | ||
was missing DOTNET_ROOT, should try to set it automatically? roslynLanguageServer does | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.