Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLTools is blocking user snippets #275

Closed
bodzebod opened this issue Jun 19, 2019 · 4 comments
Closed

SQLTools is blocking user snippets #275

bodzebod opened this issue Jun 19, 2019 · 4 comments
Labels

Comments

@bodzebod
Copy link

Hi,
I used to have user snippets for inserting static code in my SQL files, based on my company's standards.
My snippets are called by entering the words "head" and "tail".
However, when I install SQLTools, those words are no longer recognized.
Please can you advise ? Thank you!

My user snippet:

{
	// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and 
	// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope 
	// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is 
	// used to trigger the snippet and the body will be expanded and inserted. Possible variables are: 
	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. 
	// Placeholders with the same ids are connected.
	// Example:
	// "Print to console": {
	// 	"scope": "javascript,typescript",
	// 	"prefix": "log",
	// 	"body": [
	// 		"console.log('$1');",
	// 		"$2"
	// 	],
	// 	"description": "Log output to console"
	// }
	"Oracle PLSQL Header": {
		"scope": "sql",
		"prefix": "head",
		"body": [
				"\nSET ECHO ON",
				"WHENEVER SQLERROR EXIT FAILURE ROLLBACK",
				"\n", 
				"PROMPT 'BEGIN OF THE SCRIPT : ${1:script_name}' \n"
		],
		"description": "Add header to PLSQL script for SVN commit"
	},

	"Oracle PLSQL Tail": {
		"scope": "sql",
		"prefix": "tail",
		"body": [
			"INSERT INTO DB_SCRIPTS",
			"(DCR_NO, DCR_DESC, DATE_APPLIED, VERSION)",
			"SELECT COALESCE(MAX(DCR_NO),0)+1, '${1:script_name}', CURRENT_TIMESTAMP, '${2:version}' FROM DB_SCRIPTS;\n",		 
			"\n",	 
			"PROMPT 'END OF THE SCRIPT : ${1:script_name}'",
			"--",
			"--End of Script",
			"--",
			"COMMIT;",
			"EXIT"
		],
		"description": "Add tail to PLSQL script for SVN commit"
	}
}
@mtxr
Copy link
Owner

mtxr commented Jun 19, 2019

Hi,

sorry for the late reply, I had to deal with some stuff here in the past week, I'll take a look at this within this week.

Thanks!

@mtxr mtxr added bug and removed triage labels Jul 24, 2019
@mtxr
Copy link
Owner

mtxr commented Aug 4, 2019

@bodzebod I don't know exactly if I got this issue to reproduce it.
Look, if I hit Ctrl+space to get suggestions, I see your snippets that I've added here:

image

And if I start h and wait or hit ctrl_space, I see it too:
image

Can you describe a bit more what is happening or how were you using before the extension and how can I reproduce it after installing?

My personal snippets are also working fine, so I need more details to understand this.

@mtxr mtxr added triage and removed bug labels Aug 4, 2019
@forrcaho
Copy link

forrcaho commented Aug 8, 2019

I am also having a problem with snippets.

I did not know about the Ctrl+space shortcut; I'm used to just typing in the snippet prefix, and it will show up in the list of completions (along with other possible completions).

The Ctrl+space shortcut makes my snippets show up, which is a good workaround to have, but unless I use that, I do not see snippets in my list of completions whenever I have an SQLTools db connection open. This is true not only in the Session.sql editor window, but all editor windows I have open, related to sql or not.

Once I disconnect from the db, snippets resume showing up among my completion options.

Some details which may or may not be relevant:

  • I am connecting to an AWS Redshift db.
  • I am working on a remote system via the Remote - SSH extension.
  • I am using Insiders edition.

@bodzebod
Copy link
Author

Sorry for the late reply, I retried and I don't have issues anymore indeed.
I guess I made a mistake somewhere and misunderstand what happened. It looks like sqltools is not preventing my snippets to work.
So the issue report can be closed. Thank you for your support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants