1- 'use strict' ;
1+ import * as fs from 'fs'
2+ import * as path from 'path'
23
3- import * as fs from 'fs' ;
4- import * as path from 'path' ;
4+ import * as pcp from 'promisify-child-process'
5+ import * as compareVersions from 'compare-versions'
56
6- import * as pcp from 'promisify-child-process' ;
7- import * as compareVersions from 'compare-versions' ;
7+ import { ChildProcess } from "child_process"
88
9- import { ChildProcess } from "child_process" ;
10-
11- import { ExtensionContext } from 'vscode' ;
12- import * as vscode from 'vscode' ;
9+ import { ExtensionContext } from 'vscode'
10+ import * as vscode from 'vscode'
1311import { LanguageClient , LanguageClientOptions , RevealOutputChannelOn ,
14- ServerOptions } from 'vscode-languageclient' ;
12+ ServerOptions } from 'vscode-languageclient'
1513import { enableOldServerWorkaround } from './compat'
1614import * as features from './features'
1715
1816export let client : LanguageClient
1917
2018import * as rpc from 'vscode-jsonrpc'
2119import * as sbtserver from './sbt-server'
20+ import { Tracer } from './tracer'
21+
22+ export const extensionName = 'dotty'
23+ const extensionConfig = vscode . workspace . getConfiguration ( extensionName )
2224
2325let extensionContext : ExtensionContext
2426let outputChannel : vscode . OutputChannel
27+ let tracer : Tracer
2528
2629/** The sbt process that may have been started by this extension */
2730let sbtProcess : ChildProcess | undefined
@@ -45,9 +48,14 @@ function isConfiguredProject() {
4548
4649export function activate ( context : ExtensionContext ) {
4750 extensionContext = context
48- outputChannel = vscode . window . createOutputChannel ( "Dotty" ) ;
51+ outputChannel = vscode . window . createOutputChannel ( "Dotty" )
52+ tracer = new Tracer ( {
53+ extensionContext,
54+ extensionConfig,
55+ extensionOut : outputChannel ,
56+ } )
4957
50- const coursierPath = path . join ( extensionContext . extensionPath , "out" , "coursier" ) ;
58+ const coursierPath = path . join ( extensionContext . extensionPath , "out" , "coursier" )
5159 const dottyPluginSbtFileSource = path . join ( extensionContext . extensionPath , "out" , "dotty-plugin.sbt" )
5260 const buildSbtFileSource = path . join ( extensionContext . extensionPath , "out" , "build.sbt" )
5361
@@ -297,6 +305,8 @@ function bootstrapSbtProject(buildSbtFileSource: string,
297305}
298306
299307function run ( serverOptions : ServerOptions , isOldServer : boolean ) {
308+ const lspOutputChannel = tracer . run ( )
309+
300310 const clientOptions : LanguageClientOptions = {
301311 documentSelector : [
302312 { scheme : 'file' , pattern : '**/*.sc' } ,
@@ -307,11 +317,11 @@ function run(serverOptions: ServerOptions, isOldServer: boolean) {
307317 synchronize : {
308318 configurationSection : 'dotty'
309319 } ,
310- outputChannel : outputChannel ,
320+ outputChannel : lspOutputChannel ,
311321 revealOutputChannelOn : RevealOutputChannelOn . Never
312322 }
313323
314- client = new LanguageClient ( "dotty" , "Dotty" , serverOptions , clientOptions )
324+ client = new LanguageClient ( extensionName , "Dotty" , serverOptions , clientOptions )
315325 client . registerFeature ( new features . WorksheetRunFeature ( client ) )
316326
317327 if ( isOldServer )
0 commit comments