-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[20231027]Feat/support tips feature (#4)
* support login with AKSK input * add aksk input * login with AKSK: 1.store aksk in process. 2.add refresh feature. 3.add icon pkg. * add aksk input * support: set aksk and terraform init/plan/apply/destroy cmd * update tiat-resource.config * 1.add res doc redirect function. 2.adjust tips logic. * 1.scrape tool. 2.adjust package.json for npm compile.
- Loading branch information
Showing
19 changed files
with
35,702 additions
and
19,288 deletions.
There are no files selected for viewing
Empty file.
This file was deleted.
Oops, something went wrong.
53,731 changes: 34,697 additions & 19,034 deletions
53,731
config/snippets/tiat-resources.json → config/tips/tiat-resources.json
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { CompletionItemProvider, TextDocument, Position, CancellationToken, CompletionItem } from "vscode"; | ||
import resources from '../../config/tips/tiat-resources.json'; | ||
import * as _ from "lodash"; | ||
|
||
var topLevelTypes = ["output", "provider", "resource", "variable", "data"]; | ||
var topLevelRegexes = topLevelTypes.map(o => { | ||
return { | ||
type: o, | ||
regex: new RegExp(o + ' "[A-Za-z0-9\-_]+" "[A-Za-z0-9\-_]*" \{') | ||
}; | ||
}); | ||
|
||
export class TerraformExampleProvider implements CompletionItemProvider { | ||
document: TextDocument; | ||
position: Position; | ||
token: CancellationToken; | ||
|
||
public provideCompletionItems(document: TextDocument, position: Position, token: CancellationToken): CompletionItem[] { | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { HoverProvider, TextDocument, Position, CancellationToken, CompletionItem, CompletionItemKind, Hover, ProviderResult } from "vscode"; | ||
import resources from '../../config/tips/tiat-resources.json'; | ||
import * as _ from "lodash"; | ||
|
||
var topLevelTypes = ["output", "provider", "resource", "variable", "data"]; | ||
var topLevelRegexes = topLevelTypes.map(o => { | ||
return { | ||
type: o, | ||
regex: new RegExp(o + ' "[A-Za-z0-9\-_]+" "[A-Za-z0-9\-_]*" \{') | ||
}; | ||
}); | ||
|
||
export class TerraformHoverProvider implements HoverProvider { | ||
provideHover(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Hover> { | ||
throw new Error("Method not implemented."); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { | ||
DefinitionProvider, | ||
TextDocument, | ||
Position, | ||
CancellationToken, | ||
Definition | ||
} from "vscode"; | ||
import * as _ from "lodash"; | ||
// import * as opn from "opn"; | ||
import opn from "opn"; | ||
import resources from '../../config/tips/tiat-resources.json'; | ||
|
||
const urlPrefix = "https://www.terraform.io"; | ||
|
||
export class TerraformResDocProvider implements DefinitionProvider { | ||
public provideDefinition(document: TextDocument, position: Position, token: CancellationToken): Definition { | ||
const words = document.getWordRangeAtPosition(position); | ||
const resName = document.getText(words); | ||
|
||
const found = _.get(resources, resName); | ||
const urlSuffix = found.url?.toString() || ""; | ||
var target = <string>(urlPrefix + urlSuffix); | ||
if (urlSuffix && target) { | ||
opn(target); | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.