Skip to content

Commit

Permalink
Fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
renkun-ken committed May 18, 2024
1 parent f78966f commit c6fde97
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 26 deletions.
7 changes: 2 additions & 5 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ webpack.config.js
.markdownlint.json
.eslintignore

# node_modules #withWebpack
# out/ #withWebpack
node_modules
out/

# withoutWebpack:
dist
# /withoutWebpack
24 changes: 6 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"onCommand:r.runSelectionInActiveTerm",
"onWebviewPanel:rhelp"
],
"main": "./out/extension",
"main": "./dist/extension",
"contributes": {
"terminal": {
"profiles": [
Expand Down Expand Up @@ -1437,7 +1437,7 @@
"default": [],
"markdownDescription": "Additional library paths to launch R background processes (R languageserver, help server, etc.). These paths will be appended to `.libPaths()` on process startup. It could be useful for projects with [renv](https://rstudio.github.io/renv/index.html) enabled."
},
"r.useRenvLibPath" : {
"r.useRenvLibPath": {
"type": "boolean",
"default": false,
"markdownDescription": "Use renv library paths to launch R background processes (R languageserver, help server, etc.)."
Expand Down Expand Up @@ -2076,28 +2076,15 @@
]
},
"scripts": {
"vscode:prepublish": "tsc -p . && tsc -p ./html/help && tsc -p ./html/httpgd",
"compile": "tsc -p . && tsc -p ./html/help && tsc -p ./html/httpgd",
"watch": "tsc -p . --watch",
"vscode:prepublish": "tsc -p ./html/help && tsc -p ./html/httpgd && webpack --mode production",
"compile": "tsc -p ./html/help && tsc -p ./html/httpgd && webpack --mode none",
"watch": "webpack --mode none --watch",
"watchHelp": "tsc -p ./html/help --watch",
"watchHttpgd": "tsc -p ./html/httpgd --watch",
"pretest": "tsc -p ./",
"test": "node ./out/test/runTest.js",
"lint": "eslint src --ext ts"
},
"withWebpack": {
"scripts": {
"vscode:prepublish": "tsc -p ./html/help && tsc -p ./html/httpgd && webpack --mode production",
"compile": "tsc -p ./html/help && tsc -p ./html/httpgd && webpack --mode none",
"watch": "webpack --mode none --watch",
"watchHelp": "tsc -p ./html/help --watch",
"watchHttpgd": "tsc -p ./html/httpgd --watch",
"pretest": "tsc -p ./",
"test": "node ./out/test/runTest.js",
"lint": "eslint src --ext ts"
},
"main": "./dist/extension"
},
"devDependencies": {
"@types/cheerio": "^0.22.29",
"@types/ejs": "^3.0.6",
Expand Down Expand Up @@ -2126,6 +2113,7 @@
"webpack-cli": "^4.7.2"
},
"dependencies": {
"@types/highlight.js": "^10.1.0",
"ag-grid-community": "^31.3.2",
"cheerio": "1.0.0-rc.12",
"crypto": "^1.0.1",
Expand Down
5 changes: 4 additions & 1 deletion src/helpViewer/helpPreviewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,17 @@ export class RLocalHelpPreviewer {
this.cachedPackageInfo = undefined;
this.callPreviewListener();
};
const manDirListener: fs.WatchListener<string> = (event: fs.WatchEventType, filename: string) => {
const manDirListener: fs.WatchListener<string | null> = (event: fs.WatchEventType, filename: string | null) => {
if(this.isDisposed){
return;
}
if(!isDirSafe(this.manDir)){
this.dispose(true);
return;
}
if (filename === null) {
return;
}
const fullPath = path.join(this.manDir, filename);
// The cache is only initialized when it is needed for the first time:
if(this.cachedRdAliases){
Expand Down
2 changes: 1 addition & 1 deletion src/helpViewer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ function pimpMyHelp(helpFile: HelpFile): HelpFile {

// apply syntax highlighting to each code section:
codeSections.each((i, section) => {
const styledCode = hljs.highlight($(section).text() || '', {
const styledCode = hljs.default.highlight($(section).text() || '', {
language: 'r',
});
$(section).html(styledCode.value);
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@
"@types/minimatch" "*"
"@types/node" "*"

"@types/highlight.js@^10.1.0":
version "10.1.0"
resolved "https://registry.yarnpkg.com/@types/highlight.js/-/highlight.js-10.1.0.tgz#89bb0c202997d7a90a07bd2ec1f7d00c56bb90b4"
integrity sha512-77hF2dGBsOgnvZll1vymYiNUtqJ8cJfXPD6GG/2M0aLRc29PkvB7Au6sIDjIEFcSICBhCh2+Pyq6WSRS7LUm6A==
dependencies:
highlight.js "*"

"@types/js-yaml@^4.0.2":
version "4.0.3"
resolved "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.3.tgz"
Expand Down Expand Up @@ -1665,7 +1672,7 @@ [email protected]:
resolved "https://registry.npmjs.org/he/-/he-1.2.0.tgz"
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==

highlight.js@^11.9.0:
highlight.js@*, highlight.js@^11.9.0:
version "11.9.0"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.9.0.tgz#04ab9ee43b52a41a047432c8103e2158a1b8b5b0"
integrity sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw==
Expand Down

0 comments on commit c6fde97

Please sign in to comment.