Skip to content

Commit

Permalink
feat: add dev command for printing uri of active document
Browse files Browse the repository at this point in the history
chore: up vscode types to latest
  • Loading branch information
zardoy committed Jun 8, 2022
1 parent 4679624 commit 7af68e0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@
{
"command": "cutLineContentsPreserve",
"title": "Cut Line Contents and Preserve Line"
},
{
"command": "printActiveDocumrntUri",
"title": "Print Active Documrnt URI"
}
],
"configuration": [
Expand Down Expand Up @@ -312,7 +316,7 @@
},
"devDependencies": {
"@types/node": "^16.11.26",
"@types/vscode": "^1.65.0",
"@types/vscode": "^1.66.0",
"@zardoy/tsconfig": "^1.4.0",
"eslint": "^8.11.0",
"eslint-config-zardoy": "^0.2.10",
Expand Down
34 changes: 17 additions & 17 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { registerCutLineContents } from './features/cutLineContents'
import { registerCutLineContentsPreserve } from './features/cutLineContentsPreserve'
import typeDecorations from './features/typeDecorations'
import autoRemoveSemicolon from './features/autoRemoveSemicolon'
import printDocumentUri from './features/printDocumentUri'

export const activate = () => {
// preserve camelcase identifiers (only vars for now)
Expand Down Expand Up @@ -78,6 +79,7 @@ export const activate = () => {
registerCutLineContentsPreserve()
typeDecorations()
autoRemoveSemicolon()
printDocumentUri()

// vscode.languages.registerSelectionRangeProvider('*', {
// provideSelectionRanges(document, positions, token) {
Expand Down
9 changes: 9 additions & 0 deletions src/features/printDocumentUri.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { getActiveRegularEditor } from '@zardoy/vscode-utils'
import { registerExtensionCommand } from 'vscode-framework'

export default () => {
registerExtensionCommand('printActiveDocumrntUri', () => {
const editor = getActiveRegularEditor()
console.log(editor?.document.uri)
})
}

0 comments on commit 7af68e0

Please sign in to comment.