@@ -36,25 +36,19 @@ export function runCompletionCommand(
36
36
let tmpname = utils . createFileInTempDir ( ) ;
37
37
fs . writeFileSync ( tmpname , code , { encoding : "utf-8" } ) ;
38
38
39
- try {
40
- let stdout = execFileSync (
41
- binaryPath ,
42
- [
43
- "complete" ,
44
- filePath ,
45
- msg . params . position . line ,
46
- msg . params . position . character ,
47
- tmpname ,
48
- ] ,
49
- { cwd : projectRootPath }
50
- ) ;
51
- return JSON . parse ( stdout . toString ( ) ) ;
52
- } catch ( error ) {
53
- // TODO: @cristianoc any exception possible?
54
- return null ;
55
- } finally {
56
- fs . unlink ( tmpname , ( ) => null ) ;
57
- }
39
+ let stdout = execFileSync (
40
+ binaryPath ,
41
+ [
42
+ "complete" ,
43
+ filePath ,
44
+ msg . params . position . line ,
45
+ msg . params . position . character ,
46
+ tmpname ,
47
+ ] ,
48
+ { cwd : projectRootPath }
49
+ ) ;
50
+ fs . unlink ( tmpname , ( ) => null ) ;
51
+ return JSON . parse ( stdout . toString ( ) ) ;
58
52
}
59
53
60
54
export function runHoverCommand ( msg : RequestMessage ) : Hover | null {
@@ -65,22 +59,17 @@ export function runHoverCommand(msg: RequestMessage): Hover | null {
65
59
return null ;
66
60
}
67
61
68
- try {
69
- let stdout = execFileSync (
70
- binaryPath ,
71
- [
72
- "hover" ,
73
- filePath ,
74
- msg . params . position . line ,
75
- msg . params . position . character ,
76
- ] ,
77
- { cwd : projectRootPath }
78
- ) ;
79
- return JSON . parse ( stdout . toString ( ) ) ;
80
- } catch ( error ) {
81
- // TODO: @cristianoc any exception possible?
82
- return null ;
83
- }
62
+ let stdout = execFileSync (
63
+ binaryPath ,
64
+ [
65
+ "hover" ,
66
+ filePath ,
67
+ msg . params . position . line ,
68
+ msg . params . position . character ,
69
+ ] ,
70
+ { cwd : projectRootPath }
71
+ ) ;
72
+ return JSON . parse ( stdout . toString ( ) ) ;
84
73
}
85
74
86
75
export function runDefinitionCommand ( msg : RequestMessage ) : Location | null {
@@ -91,20 +80,15 @@ export function runDefinitionCommand(msg: RequestMessage): Location | null {
91
80
return null ;
92
81
}
93
82
94
- try {
95
- let stdout = execFileSync (
96
- binaryPath ,
97
- [
98
- "definition" ,
99
- filePath ,
100
- msg . params . position . line ,
101
- msg . params . position . character ,
102
- ] ,
103
- { cwd : projectRootPath }
104
- ) ;
105
- return JSON . parse ( stdout . toString ( ) ) ;
106
- } catch ( error ) {
107
- // TODO: @cristianoc any exception possible?
108
- return null ;
109
- }
83
+ let stdout = execFileSync (
84
+ binaryPath ,
85
+ [
86
+ "definition" ,
87
+ filePath ,
88
+ msg . params . position . line ,
89
+ msg . params . position . character ,
90
+ ] ,
91
+ { cwd : projectRootPath }
92
+ ) ;
93
+ return JSON . parse ( stdout . toString ( ) ) ;
110
94
}
0 commit comments