@@ -18,7 +18,7 @@ function createTSServerInstance() {
1818 return new Promise ( ( resolve , reject ) => {
1919 const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
2020 const tsserverPath = path . join ( __dirname , '..' , '..' , 'node_modules' , 'typescript' , 'bin' , 'tsserver' ) ;
21- const nodePath = '/home/charly/.nvm/versions/node/v20.10.0/bin/ node' ;
21+ const nodePath = 'node' ;
2222 tsserverProcess = spawn ( nodePath , [ tsserverPath ] ) ;
2323 tsserverProcess . stdout . setEncoding ( 'utf8' ) ;
2424
@@ -142,6 +142,25 @@ function createTSServerInstance() {
142142 return sendCommand ( command ) ;
143143 }
144144
145+ /**
146+ * Sends a 'quickinfo' request to the TypeScript Server.
147+ * @param {string } filePath - The path to the file.
148+ * @param {number } line - The line number of the position.
149+ * @param {number } offset - The offset in the line of the position.
150+ * @returns {Promise<Object> } A promise that resolves with the response from tsserver.
151+ */
152+ function getQuickInfo ( filePath , line , offset ) {
153+ const command = {
154+ command : "quickinfo" ,
155+ arguments : {
156+ file : filePath ,
157+ line : line ,
158+ offset : offset
159+ }
160+ } ;
161+ return sendCommand ( command ) ;
162+ }
163+
145164
146165 /**
147166 * Sends a 'references' request to the TypeScript Server.
@@ -162,6 +181,25 @@ function createTSServerInstance() {
162181 return sendCommand ( command ) ;
163182 }
164183
184+ /**
185+ * Sends a 'FindSourceDefinition' request to the TypeScript Server.
186+ * @param {string } filePath - The path to the file.
187+ * @param {number } line - The line number of the position.
188+ * @param {number } offset - The offset in the line of the position.
189+ * @returns {Promise<Object> } A promise that resolves with the response from tsserver.
190+ */
191+ function findSourceDefinition ( filePath , line , offset ) {
192+ const command = {
193+ command : "findSourceDefinition" ,
194+ arguments : {
195+ file : filePath ,
196+ line : line ,
197+ offset : offset
198+ }
199+ } ;
200+ return sendCommand ( command ) ;
201+ }
202+
165203 /**
166204 * Kills the TypeScript Server process.
167205 */
@@ -178,7 +216,9 @@ function createTSServerInstance() {
178216 openFile,
179217 killServer : killTSServer ,
180218 getDefinition : getDefinition ,
181- findReferences : findReferences
219+ findReferences : findReferences ,
220+ getQuickInfo : getQuickInfo ,
221+ findSourceDefinition : findSourceDefinition
182222 } ;
183223}
184224
0 commit comments