Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
675864e2
Commit
675864e2
authored
Jul 17, 2017
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for syntax highlighting any support lang for monaco.
parent
9c521c85
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
34 deletions
+39
-34
app/assets/javascripts/repo/repo_commit_section.js
app/assets/javascripts/repo/repo_commit_section.js
+0
-1
app/assets/javascripts/repo/repo_editor.js
app/assets/javascripts/repo/repo_editor.js
+5
-3
app/assets/javascripts/repo/repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+13
-7
app/assets/javascripts/repo/repo_sidebar.js
app/assets/javascripts/repo/repo_sidebar.js
+21
-23
No files found.
app/assets/javascripts/repo/repo_commit_section.js
View file @
675864e2
...
...
@@ -16,7 +16,6 @@ export default class RepoCommitSection {
changedFiles
()
{
const
changedFileList
=
this
.
openedFiles
.
filter
(
file
=>
file
.
changed
);
console
.
log
(
'
changedFileList
'
,
changedFileList
);
return
changedFileList
;
},
},
...
...
app/assets/javascripts/repo/repo_editor.js
View file @
675864e2
...
...
@@ -32,7 +32,6 @@ export default class RepoEditor {
Helper
.
monacoInstance
=
monaco
;
this
.
initVue
();
monaco
.
languages
.
getLanguages
();
this
.
addMonacoEvents
();
});
}
...
...
@@ -113,10 +112,13 @@ export default class RepoEditor {
self
.
monacoEditor
.
setModel
(
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
this
.
activeFile
.
mime_type
,
Helper
.
getLanguageForFile
(
this
.
activeFile
,
monaco
.
languages
.
getLanguages
()
),
),
);
console
.
log
(
monaco
.
editor
.
getModels
());
}
},
},
...
...
app/assets/javascripts/repo/repo_helper.js
View file @
675864e2
...
...
@@ -14,13 +14,19 @@ const RepoHelper = {
?
window
.
performance
:
Date
,
getLanguagesForMimeType
(
mimetypeNeedle
)
{
const
langs
=
window
.
monaco
.
languages
.
getLanguages
();
langs
.
map
((
lang
)
=>
{
const
hasLang
=
lang
.
mimetypes
.
some
(
mimetype
=>
mimetypeNeedle
===
mimetype
);
if
(
hasLang
)
return
lang
.
id
;
return
lang
;
});
getLanguageForFile
(
file
,
langs
)
{
const
ext
=
`.
${
file
.
name
.
split
(
'
.
'
).
pop
()}
`
;
let
foundLang
;
if
(
langs
.
some
((
l
)
=>
{
if
(
l
.
extensions
&&
l
.
extensions
.
indexOf
(
ext
)
>
-
1
)
{
foundLang
=
l
;
return
true
;
}
return
false
;
}))
{
return
foundLang
.
id
}
return
'
plain
'
;
},
blobURLtoParent
(
url
)
{
...
...
app/assets/javascripts/repo/repo_sidebar.js
View file @
675864e2
import
Vue
from
'
vue
'
;
import
Service
from
'
./repo_service
'
;
import
Helper
from
'
./repo_helper
'
;
import
Store
from
'
./repo_store
'
;
import
RepoPreviousDirectory
from
'
./repo_prev_directory
'
;
import
RepoFileOptions
from
'
./repo_file_options
'
;
import
RepoFile
from
'
./repo_file
'
;
import
RepoLoadingFile
from
'
./repo_loading_file
'
;
import
RepoMiniMixin
from
'
./repo_mini_mixin
'
;
import
Service
from
'
./repo_service
'
import
Helper
from
'
./repo_helper
'
import
Vue
from
'
vue
'
import
Store
from
'
./repo_store
'
import
RepoPreviousDirectory
from
'
./repo_prev_directory
'
import
RepoFileOptions
from
'
./repo_file_options
'
import
RepoFile
from
'
./repo_file
'
import
RepoLoadingFile
from
'
./repo_loading_file
'
import
RepoMiniMixin
from
'
./repo_mini_mixin
'
export
default
class
RepoSidebar
{
constructor
(
url
)
{
...
...
@@ -35,35 +35,33 @@ export default class RepoSidebar {
methods
:
{
addPopEventListener
()
{
window
.
addEventListener
(
'
popstate
'
,
()
=>
{
if
(
location
.
href
.
indexOf
(
'
#
'
)
>
-
1
)
return
;
if
(
location
.
href
.
indexOf
(
'
#
'
)
>
-
1
)
return
;
this
.
linkClicked
({
url
:
location
.
href
,
url
:
location
.
href
});
});
},
linkClicked
(
file
)
{
console
.
log
(
'
link clicked
'
)
let
url
=
''
;
if
(
typeof
file
===
'
object
'
)
{
if
(
file
.
type
===
'
tree
'
&&
file
.
opened
)
{
if
(
typeof
file
===
'
object
'
)
{
if
(
file
.
type
===
'
tree
'
&&
file
.
opened
)
{
Helper
.
removeChildFilesOfTree
(
file
);
return
;
}
else
{
url
=
file
.
url
;
Service
.
url
=
url
;
Helper
.
getContent
(
file
);
}
url
=
file
.
url
;
Service
.
url
=
url
;
Helper
.
getContent
(
file
);
url
=
file
.
url
;
Service
.
url
=
url
;
Helper
.
getContent
(
file
);
}
else
if
(
typeof
file
===
'
string
'
)
{
}
else
if
(
typeof
file
===
'
string
'
)
{
// go back
url
=
file
;
Service
.
url
=
url
;
Helper
.
getContent
();
}
}
,
}
},
});
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment