Skip to content

Commit

Permalink
Merge pull request #111 from AvaloniaUI:prashantvc/issue94
Browse files Browse the repository at this point in the history
Previewer not working, unexpected end of json input
  • Loading branch information
prashantvc authored Feb 15, 2024
2 parents 1b485cf + 2d1df44 commit c7ae745
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/vscode-avalonia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Avalonia for VSCode",
"description": "Avalonia tools for Visual Studio Code",
"publisher": "AvaloniaTeam",
"version": "0.0.29",
"version": "0.0.31",
"license": "MIT",
"preview": true,
"qna": "false",
Expand Down
10 changes: 7 additions & 3 deletions src/vscode-avalonia/src/services/solutionParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,20 @@ async function parseSolution(context: vscode.ExtensionContext): Promise<string>
const parserLocation = path.join(avaloniaExtn.extensionPath, "solutionParserTool", "SolutionParser.dll");

return new Promise<string>((resolve, reject) => {
var jsonContent = "";
const previewer = spawn(`dotnet`, [parserLocation.putInQuotes(), solutionPath.putInQuotes()], {
windowsVerbatimArguments: false,
env: process.env,
shell: true,
});

previewer.on("spawn", () => {
jsonContent = "";
logger.appendLine(`parser process args: ${previewer.spawnargs}`);
});

previewer.stdout.on("data", (data) => {
const jsonContent = data.toString();
updateSolutionModel(context, jsonContent);
resolve(jsonContent);
jsonContent += data.toString();
});

previewer.stderr.on("data", (data) => {
Expand All @@ -121,6 +121,10 @@ async function parseSolution(context: vscode.ExtensionContext): Promise<string>
});

previewer.on("close", (code) => {
if (code === 0) {
updateSolutionModel(context, jsonContent);
resolve(jsonContent);
}
logger.appendLine(`parser process exited ${code}`);
});
});
Expand Down

0 comments on commit c7ae745

Please sign in to comment.