Skip to content

Commit 453c22d

Browse files
author
sakuraash
committed
add javascript && typescript lsp
1 parent c65ab21 commit 453c22d

File tree

6 files changed

+18
-23
lines changed

6 files changed

+18
-23
lines changed

app/commons/File/actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const fetchProjectRoot = registerAction('fs:init', () =>
9696
}
9797
fetchLanguageServerSetting(config.spaceKey).then((res) => {
9898
if (res.code === 0 && res.data) {
99-
setLanguageSetting(res.data.default)
99+
setLanguageSetting([res.data.default])
100100
} else {
101101
tryIdentificationWorkSpaceType(data)
102102
.then(setLanguageSetting)

app/components/MonacoEditor/MonacoReact/BaseEditor.jsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class MonacoEditor extends React.PureComponent {
105105
if (!model) {
106106
model = monaco.editor.createModel(
107107
content,
108-
lowerCase(this.language),
108+
this.language.toLowerCase(),
109109
monaco.Uri.parse(path.startsWith('jdt://') || path.startsWith('omnisharp-metadata') ? path : `file://${languageClient._ROOT_URI_}${path}`)
110110
)
111111
this.uri = path.startsWith('jdt://') || path.startsWith('omnisharp-metadata') ? path : `file://${languageClient._ROOT_URI_}${path}`
@@ -118,17 +118,17 @@ class MonacoEditor extends React.PureComponent {
118118
monacoEditor.setModel(model)
119119
const { client, openeduri } = languageClient
120120
if (client && client.state === 3 && this.props.active && this.didmount) {
121-
if (!openeduri.get(path)) {
122-
languageClient.openTextDocument({
123-
textDocument: {
124-
uri: path.startsWith('jdt://') || path.startsWith('omnisharp-metadata') ? path : `file://${languageClient._ROOT_URI_}${path}`,
125-
languageId: lowerCase(this.language),
126-
text: content,
127-
version: 1,
128-
}
129-
})
130-
openeduri.set(path, content)
131-
}
121+
// if (!openeduri.get(path)) {
122+
// languageClient.openTextDocument({
123+
// textDocument: {
124+
// uri: path.startsWith('jdt://') || path.startsWith('omnisharp-metadata') ? path : `file://${languageClient._ROOT_URI_}${path}`,
125+
// languageId: this.language.toLowerCase(),
126+
// text: content,
127+
// version: 1,
128+
// }
129+
// })
130+
// openeduri.set(path, content)
131+
// }
132132
}
133133
}
134134
})

app/components/MonacoEditor/codeEditorService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class CodeEditorService {
5757
openCodeEditor (input, source) {
5858
toDefinition(input)
5959
const editor = this.doOpenEditor(source, input)
60-
return monaco.Promise.as(editor)
60+
return monaco.Promise.as(null)
6161
}
6262
}
6363

app/components/MonacoEditor/utils/languages.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ export default [
99
export const supportLangServer = [
1010
{ lang: 'Java', files: ['pom.xml', 'settings.gradle', 'build.gradle'], file: 'pom.xml' },
1111
{ lang: 'Python', files: ['requirements.txt'], file: 'requirements.txt' },
12-
// { lang: 'TypeScript', files: ['package.json'], file: 'package.json' },
13-
{ lang: 'C#', files: ['workspace.csproj'] },
12+
{ lang: 'TypeScript', files: ['package.json', 'tslint.json', 'tsconfig.json'], file: 'package.json' },
13+
{ lang: 'JavaScript', files: ['package.json', 'eslint.json', 'tsconfig.json'], file: 'package.json' },
14+
// { lang: 'C#', files: ['workspace.csproj'] },
1415
]
1516

1617
export const documentSelectors = [

app/settings.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import FolderSelector from 'components/Setting/FolderSelector'
1111
import { supportLangServer } from 'components/MonacoEditor/utils/languages'
1212
import { dismissModal } from 'components/Modal/actions'
1313
import { setLanguageServerOne, fetchLanguageServerSetting } from 'backendAPI/languageServerAPI'
14-
// import { projectState } from 'components/Setting/state'
1514

1615
let LanguageState
1716
import('components/MonacoEditor/LanguageClientState').then(res => LanguageState = res.default)
@@ -34,11 +33,6 @@ const localStorage = window.localStorage
3433
let EditorState
3534
import('components/Editor/state').then(res => EditorState = res.default)
3635

37-
const typeOptions = [
38-
{ name: 'Blank', value: 'blank' },
39-
{ name: 'Java', value: 'javac' }
40-
]
41-
4236
if (JSON.parse(localStorage.getItem('switchOldEditor')) === null) {
4337
localStorage.setItem('switchOldEditor', false)
4438
}

webpack_configs/monaco-plugin-config/initialOptions.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)