Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 45fbd18

Browse files
authored
Merge pull request #162 from otreblan/master
Man pages formatting fixed
2 parents a4a263d + dc1df7b commit 45fbd18

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

‎server/src/server.ts

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -134,21 +134,22 @@ export default class BashServer {
134134
}
135135
}
136136

137+
const getMarkdownHoverItem = (doc: string) => ({
138+
// LSP.MarkupContent
139+
value: ['``` man', doc, '```'].join('\n'),
140+
// Passed as markdown for syntax highlighting
141+
kind: 'markdown' as const,
142+
})
143+
137144
if (Builtins.isBuiltin(word)) {
138145
return Builtins.documentation(word).then(doc => ({
139-
contents: {
140-
language: 'plaintext',
141-
value: doc,
142-
},
146+
contents: getMarkdownHoverItem(doc),
143147
}))
144148
}
145149

146150
if (this.executables.isExecutableOnPATH(word)) {
147151
return this.executables.documentation(word).then(doc => ({
148-
contents: {
149-
language: 'plaintext',
150-
value: doc,
151-
},
152+
contents: getMarkdownHoverItem(doc),
152153
}))
153154
}
154155

@@ -216,19 +217,24 @@ export default class BashServer {
216217
const {
217218
data: { name, type },
218219
} = item
220+
221+
const getMarkdownCompletionItem = (doc: string) => ({
222+
...item,
223+
// LSP.MarkupContent
224+
documentation: {
225+
value: ['``` man', doc, '```'].join('\n'),
226+
// Passed as markdown for syntax highlighting
227+
kind: 'markdown' as const,
228+
},
229+
})
230+
219231
try {
220232
if (type === 'executable') {
221233
const doc = await this.executables.documentation(name)
222-
return {
223-
...item,
224-
detail: doc,
225-
}
234+
return getMarkdownCompletionItem(doc)
226235
} else if (type === 'builtin') {
227236
const doc = await Builtins.documentation(name)
228-
return {
229-
...item,
230-
detail: doc,
231-
}
237+
return getMarkdownCompletionItem(doc)
232238
} else {
233239
return item
234240
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /