11#!/usr/bin/env node
22
33/**
4- * @import {Commands} from '@mdx-js/language-service'
54 * @import {PluggableList, Plugin} from 'unified'
65 */
76
@@ -26,7 +25,6 @@ import remarkGfm from 'remark-gfm'
2625import { create as createMarkdownServicePlugin } from 'volar-service-markdown'
2726import { create as createTypeScriptServicePlugin } from 'volar-service-typescript'
2827import { create as createTypeScriptSyntacticServicePlugin } from 'volar-service-typescript/lib/plugins/syntactic.js'
29- import { URI } from 'vscode-uri'
3028
3129process . title = 'mdx-language-server'
3230
@@ -68,7 +66,7 @@ connection.onInitialize(async (parameters) => {
6866 return context . env . getConfiguration ?. ( 'mdx.validate' )
6967 }
7068 } ) ,
71- createMdxServicePlugin ( )
69+ createMdxServicePlugin ( connection . workspace )
7270 ]
7371
7472 if ( tsEnabled ) {
@@ -123,26 +121,6 @@ connection.onInitialize(async (parameters) => {
123121 }
124122} )
125123
126- connection . onRequest ( 'mdx/toggleDelete' , async ( parameters ) => {
127- const commands = await getCommands ( parameters . uri )
128- return commands . toggleDelete ( parameters )
129- } )
130-
131- connection . onRequest ( 'mdx/toggleEmphasis' , async ( parameters ) => {
132- const commands = await getCommands ( parameters . uri )
133- return commands . toggleEmphasis ( parameters )
134- } )
135-
136- connection . onRequest ( 'mdx/toggleInlineCode' , async ( parameters ) => {
137- const commands = await getCommands ( parameters . uri )
138- return commands . toggleInlineCode ( parameters )
139- } )
140-
141- connection . onRequest ( 'mdx/toggleStrong' , async ( parameters ) => {
142- const commands = await getCommands ( parameters . uri )
143- return commands . toggleStrong ( parameters )
144- } )
145-
146124connection . onInitialized ( ( ) => {
147125 const extensions = [ 'mdx' ]
148126 if ( tsEnabled ) {
@@ -164,12 +142,3 @@ connection.onInitialized(() => {
164142} )
165143
166144connection . listen ( )
167-
168- /**
169- * @param {string } uri
170- * @returns {Promise<Commands> }
171- */
172- async function getCommands ( uri ) {
173- const service = await server . project . getLanguageService ( URI . parse ( uri ) )
174- return service . context . inject ( 'mdxCommands' )
175- }
0 commit comments