This repository was archived by the owner on Mar 21, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 11import { execSync } from "child_process" ;
22import * as fs from "fs" ;
3+ import * as os from "os" ;
4+ import * as path from "path" ;
35import { v4 as uuidv4 } from "uuid" ;
46import * as vscode from "vscode" ;
57import { getFormatter , getFullTextRange } from "./utils" ;
@@ -18,7 +20,7 @@ export function register() {
1820 if ( ! formatter ) return [ ] ;
1921
2022 if ( textEditor ) {
21- const tempFileName = `/tmp/ vscode-reasonml-${ uuidv4 ( ) } .ml`;
23+ const tempFileName = path . join ( os . tmpdir ( ) , ` vscode-reasonml-ocamlformat- ${ uuidv4 ( ) } .ml`) ;
2224 fs . writeFileSync ( tempFileName , textEditor . document . getText ( ) , "utf8" ) ;
2325 try {
2426 const filePath = textEditor . document . fileName ;
Original file line number Diff line number Diff line change 11import { execSync } from "child_process" ;
22import * as fs from "fs" ;
3+ import * as os from "os" ;
4+ import * as path from "path" ;
35import { v4 as uuidv4 } from "uuid" ;
46import * as vscode from "vscode" ;
57import { getFormatter , getFullTextRange } from "./utils" ;
@@ -17,7 +19,7 @@ export function register() {
1719 if ( ! formatter ) return [ ] ;
1820
1921 if ( textEditor ) {
20- const tempFileName = `/tmp/ vscode-refmt-${ uuidv4 ( ) } .re` ;
22+ const tempFileName = path . join ( os . tmpdir ( ) , ` vscode-reasonml- refmt-${ uuidv4 ( ) } .ml` ) ;
2123 fs . writeFileSync ( tempFileName , textEditor . document . getText ( ) , "utf8" ) ;
2224 try {
2325 const formattedText = execSync ( `${ formatter } ${ tempFileName } ` ) . toString ( ) ;
You can’t perform that action at this time.
0 commit comments